Class: SoarAuthenticationToken::RackAuthIdTransposerMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/soar_authentication_token/rack_auth_id_transposer_middleware.rb

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ RackAuthIdTransposerMiddleware

Returns a new instance of RackAuthIdTransposerMiddleware.



5
6
7
# File 'lib/soar_authentication_token/rack_auth_id_transposer_middleware.rb', line 5

def initialize(app)
  @app = app
end

Instance Method Details

#call(env) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/soar_authentication_token/rack_auth_id_transposer_middleware.rb', line 9

def call(env)
  request = Rack::Request.new env
  authenticated_identifier = request.env['X-GATEWAY-AUTHENTICATED-IDENTIFIER']
  if authenticated_identifier
    request.session['user']    = authenticated_identifier
    request.env['REMOTE_USER'] = authenticated_identifier
  end
  return @app.call env
end