Class: OmniAuth::Strategies::Pfas::Response
- Inherits:
-
Object
- Object
- OmniAuth::Strategies::Pfas::Response
- Defined in:
- lib/omniauth/strategies/pfas/response.rb
Constant Summary collapse
- ASSERTION =
"urn:oasis:names:tc:SAML:1.0:assertion"
Instance Attribute Summary collapse
-
#document ⇒ Object
Returns the value of attribute document.
-
#options ⇒ Object
Returns the value of attribute options.
-
#response ⇒ Object
Returns the value of attribute response.
Instance Method Summary collapse
-
#attributes ⇒ Object
A hash of alle the attributes with the response.
- #expires_on ⇒ Object
-
#initialize(response, options = {}) ⇒ Response
constructor
A new instance of Response.
- #validate! ⇒ Object
Constructor Details
#initialize(response, options = {}) ⇒ Response
Returns a new instance of Response.
9 10 11 12 13 14 |
# File 'lib/omniauth/strategies/pfas/response.rb', line 9 def initialize(response, = {}) raise ArgumentError.new("Response cannot be nil") if response.nil? self. = self.response = response self.document = OmniAuth::Strategies::Pfas::SignedDocument.new(response) end |
Instance Attribute Details
#document ⇒ Object
Returns the value of attribute document.
7 8 9 |
# File 'lib/omniauth/strategies/pfas/response.rb', line 7 def document @document end |
#options ⇒ Object
Returns the value of attribute options.
7 8 9 |
# File 'lib/omniauth/strategies/pfas/response.rb', line 7 def @options end |
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/omniauth/strategies/pfas/response.rb', line 7 def response @response end |
Instance Method Details
#attributes ⇒ Object
A hash of alle the attributes with the response. Assuming there is only one value for each key
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/omniauth/strategies/pfas/response.rb', line 21 def attributes @attributes ||= begin result = {} stmt_element = REXML::XPath.first(document, "//a:Assertion/a:AttributeStatement", { "a" => ASSERTION }) return {} if stmt_element.nil? stmt_element.elements.each do |attr_element| name = attr_element.attributes["AttributeName"] value = attr_element.elements.map {|e|e.text} if value.length == 1 value = value[0] end result[name] = value end result end end |
#expires_on ⇒ Object
42 43 44 |
# File 'lib/omniauth/strategies/pfas/response.rb', line 42 def expires_on document.expires_on end |
#validate! ⇒ Object
16 17 18 |
# File 'lib/omniauth/strategies/pfas/response.rb', line 16 def validate! document.validate!(fingerprint) end |