Class: OmniAuth::Strategies::SAML_RSTR::AuthResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/strategies/saml-rstr/auth_response.rb

Constant Summary collapse

ASSERTION =
"urn:oasis:names:tc:SAML:2.0:assertion"
PROTOCOL =
"urn:oasis:names:tc:SAML:2.0:protocol"
DSIG =
"http://www.w3.org/2000/09/xmldsig#"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, options = {}) ⇒ AuthResponse

Returns a new instance of AuthResponse.

Raises:

  • (ArgumentError)


14
15
16
17
18
19
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 14

def initialize(response, options = {})
  raise ArgumentError.new("Response cannot be nil") if response.nil?
  self.options  = options
  self.response = response
  self.security_token_content = OmniAuth::Strategies::SAML_RSTR::XMLSecurity::SecurityTokenResponseContent.new(response)
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



12
13
14
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 12

def options
  @options
end

#responseObject

Returns the value of attribute response.



12
13
14
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 12

def response
  @response
end

#security_token_contentObject

Returns the value of attribute security_token_content.



12
13
14
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 12

def security_token_content
  @security_token_content
end

#settingsObject

Returns the value of attribute settings.



12
13
14
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 12

def settings
  @settings
end

Instance Method Details

#attributesObject

A hash of all the attributes with the response. Assuming there is only one value for each key



35
36
37
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 35

def attributes
  { :userEmailID => @security_token_content.name_identifier}
end

#conditionsObject

Conditions (if any) for the assertion to run



47
48
49
50
51
52
53
54
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 47

def conditions
  @conditions ||= begin
     {
      :before =>  security_token_content.conditions_before,
      :not_on_or_after => security_token_content.conditions_not_on_or_after
     }
  end
end

#name_idObject

The value of the user identifier as designated by the initialization request response



30
31
32
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 30

def name_id
  @security_token_content.name_identifier
end

#session_expires_atObject

When this user session should expire at latest



40
41
42
43
44
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 40

def session_expires_at
   @expires_at ||= begin
     parse_time(security_token_content.conditions_not_on_or_after)
   end
end

#valid?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 21

def valid?
  validate(soft = true)
end

#validate!Object



25
26
27
# File 'lib/omniauth/strategies/saml-rstr/auth_response.rb', line 25

def validate!
  validate(soft = false)
end