Class: Samlr::Response
- Extended by:
- Forwardable
- Defined in:
- lib/samlr/response.rb
Overview
This is the object interface to the XML response object.
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#assertion ⇒ Object
Returns the assertion element.
-
#initialize(data, options) ⇒ Response
constructor
A new instance of Response.
- #location ⇒ Object
- #signature ⇒ Object
-
#verify! ⇒ Object
The verification process assumes that all signatures are enveloped.
Constructor Details
Instance Attribute Details
#document ⇒ Object (readonly)
Returns the value of attribute document.
11 12 13 |
# File 'lib/samlr/response.rb', line 11 def document @document end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/samlr/response.rb', line 11 def @options end |
Class Method Details
Instance Method Details
#assertion ⇒ Object
Returns the assertion element. Only supports a single assertion.
44 45 46 |
# File 'lib/samlr/response.rb', line 44 def assertion @assertion ||= Samlr::Assertion.new(document, ) end |
#location ⇒ Object
35 36 37 |
# File 'lib/samlr/response.rb', line 35 def location "/samlp:Response" end |
#signature ⇒ Object
39 40 41 |
# File 'lib/samlr/response.rb', line 39 def signature @signature ||= Samlr::Signature.new(document, location, ) end |
#verify! ⇒ Object
The verification process assumes that all signatures are enveloped. Since this process is destructive the document needs to verify itself first, and then any signed assertions
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/samlr/response.rb', line 20 def verify! if signature.missing? && assertion.signature.missing? raise Samlr::SignatureError.new("Neither response nor assertion signed with a certificate") end if document.xpath("//samlp:Response", Samlr::NS_MAP).size > 1 raise Samlr::FormatError.new("multiple responses") end signature.verify! unless signature.missing? assertion.verify! true end |