Class: DeviseScim::Middleware::Authenticator

Inherits:
Object
  • Object
show all
Defined in:
lib/devise_scim/middleware/authenticator.rb

Constant Summary collapse

SCIM_CONTENT_TYPE =
"application/scim+json"

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ Authenticator

Returns a new instance of Authenticator.



8
9
10
# File 'lib/devise_scim/middleware/authenticator.rb', line 8

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/devise_scim/middleware/authenticator.rb', line 12

def call(env)
  return @app.call(env) unless scim_path?(env["PATH_INFO"])

  result = build_strategy.authenticate(env)

  if result.nil?
    unauthorized_response(env)
  else
    env["devise_scim.tenant"] = result unless result == :ok
    @app.call(env)
  end
end