Class: RSAML::Protocol::RequestedAuthnContext

Inherits:
Object
  • Object
show all
Defined in:
lib/rsaml/protocol/requested_authn_context.rb

Overview

Specifies the authentication context requirements of authentication statements returned in response to a request or query.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.comparisonsObject

List of available comparison values



7
8
9
# File 'lib/rsaml/protocol/requested_authn_context.rb', line 7

def self.comparisons
  @comparisons ||= ['exact','minimum','maximum','better']
end

Instance Method Details

#authn_context_refsObject

Authentication context references, either AuthnContextDeclRef or AuthnContextClassRef.



12
13
14
# File 'lib/rsaml/protocol/requested_authn_context.rb', line 12

def authn_context_refs
  @authn_context_refs ||= []
end

#comparisonObject

Specifies the comparison method used to evaluate the requested context classes or statements, one of “exact”, “minimum”, “maximum”, or “better”. The default is “exact”



18
19
20
# File 'lib/rsaml/protocol/requested_authn_context.rb', line 18

def comparison
  @comparison ||= 'exact'
end

#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object

Construct an XML fragment representing the requested authn context



28
29
30
31
# File 'lib/rsaml/protocol/requested_authn_context.rb', line 28

def to_xml(xml=Builder::XmlMarkup.new)
  attributes = {'Comparison' => comparison}
  xml.tag!('samlp:RequestedAuthnContext')
end

#validateObject

Validate the structure of the requested authn context

Raises:



23
24
25
# File 'lib/rsaml/protocol/requested_authn_context.rb', line 23

def validate
  raise ValidationError, "Unknown comparison type: #{comparison}" unless RequestedAuthContext.comparisons.include?(comparison)
end