Class: Rack::Saml::ResponseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/saml/response_handler.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request, config, metadata) ⇒ ResponseHandler

Rack::Saml::ResponseHandler request: Rack current request instance config: config/saml.yml metadata: specified idp entity in the config/metadata.yml



14
15
16
# File 'lib/rack/saml/response_handler.rb', line 14

def initialize(request, config, )
  @response = (eval "Rack::Saml::#{config['assertion_handler'].to_s.capitalize}Response").new(request, config, )
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



8
9
10
# File 'lib/rack/saml/response_handler.rb', line 8

def response
  @response
end

Class Method Details

.extract_attrs(env, session) ⇒ Object



36
37
38
39
40
# File 'lib/rack/saml/response_handler.rb', line 36

def self.extract_attrs(env, session)
  session.env.each do |k, v|
    env[k] = v
  end
end

Instance Method Details

#extract_attrs(env, session, attribute_map) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/rack/saml/response_handler.rb', line 18

def extract_attrs(env, session, attribute_map)
  if session.env.empty?
    attribute_map.each do |attr_name, env_name|
      attribute = @response.attributes[attr_name]
      if !attribute.nil?
        session.env[env_name] = attribute
      end
    end
    if !@response.config['shib_app_id'].nil?
      session.env['Shib-Application-ID'] = @response.config['shib_app_id']
    end
    session.env['Shib-Session-ID'] = session.get_sid('saml_res')
  end
  session.env.each do |k, v|
    env[k] = v
  end
end