Module: Escher::RackMiddleware::Authenticator::Helper
- Defined in:
- lib/escher/rack_middleware/authenticator/helper.rb
Instance Method Summary collapse
- #authorized?(request_env) ⇒ Boolean
- #authorized_with?(escher_authenticator, request_env) ⇒ Boolean
- #escher_authenticators ⇒ Object
Instance Method Details
#authorized?(request_env) ⇒ Boolean
7 8 9 10 |
# File 'lib/escher/rack_middleware/authenticator/helper.rb', line 7 def (request_env) logger.warn('No Escher authenticator was found. Check your config!') if escher_authenticators.empty? escher_authenticators.any? { |instance_init| (instance_init.call, request_env) } end |
#authorized_with?(escher_authenticator, request_env) ⇒ Boolean
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/escher/rack_middleware/authenticator/helper.rb', line 12 def (escher_authenticator, request_env) request_env['escher.request.api_key_id'] = escher_authenticator.authenticate( Rack::Request.new(request_env), credentials) request_env.delete('escher.error') rescue nil logger.debug((request_env)) true rescue Escher::EscherError => ex request_env['escher.error'] = ex. || ex.inspect logger.warn((request_env)) false rescue => ex # escher fails, bad implementations logger.warn(ex) false end |
#escher_authenticators ⇒ Object
3 4 5 |
# File 'lib/escher/rack_middleware/authenticator/helper.rb', line 3 def escher_authenticators self.class.escher_authenticators end |