Class: Otto::Security::Authentication::Strategies::NoAuthStrategy

Inherits:
AuthStrategy
  • Object
show all
Defined in:
lib/otto/security/authentication/strategies/noauth_strategy.rb

Overview

Public access strategy - always allows access

Instance Method Summary collapse

Instance Method Details

#authenticate(env, _requirement) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/otto/security/authentication/strategies/noauth_strategy.rb', line 14

def authenticate(env, _requirement)
  # Canonical client IP ("resolve once, read everywhere"): masked by
  # IPPrivacyMiddleware when privacy is on; REMOTE_ADDR fallback when
  # the middleware has not run.
   = { ip: env['otto.client_ip'] || env['REMOTE_ADDR'] }
  [:country] = env['otto.privacy.geo_country'] if env['otto.privacy.geo_country']

  Otto::Security::Authentication::StrategyResult.anonymous(metadata: )
end