Class: Saml::Kit::Builders::Response
- Inherits:
-
Object
- Object
- Saml::Kit::Builders::Response
- Defined in:
- lib/saml/kit/builders/response.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#encrypt ⇒ Object
Returns the value of attribute encrypt.
-
#id ⇒ Object
Returns the value of attribute id.
-
#issuer ⇒ Object
Returns the value of attribute issuer.
-
#now ⇒ Object
Returns the value of attribute now.
-
#reference_id ⇒ Object
Returns the value of attribute reference_id.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#sign ⇒ Object
Returns the value of attribute sign.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(user, request) ⇒ Response
constructor
A new instance of Response.
- #to_xml ⇒ Object
- #want_assertions_signed ⇒ Object
Constructor Details
#initialize(user, request) ⇒ Response
Returns a new instance of Response.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/saml/kit/builders/response.rb', line 10 def initialize(user, request) @user = user @request = request @id = Id.generate @reference_id = Id.generate @now = Time.now.utc @version = "2.0" @status_code = Namespaces::SUCCESS @issuer = configuration.issuer @destination = destination_for(request) @sign = want_assertions_signed @encrypt = false end |
Instance Attribute Details
#destination ⇒ Object
Returns the value of attribute destination.
8 9 10 |
# File 'lib/saml/kit/builders/response.rb', line 8 def destination @destination end |
#encrypt ⇒ Object
Returns the value of attribute encrypt.
8 9 10 |
# File 'lib/saml/kit/builders/response.rb', line 8 def encrypt @encrypt end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/saml/kit/builders/response.rb', line 6 def id @id end |
#issuer ⇒ Object
Returns the value of attribute issuer.
8 9 10 |
# File 'lib/saml/kit/builders/response.rb', line 8 def issuer @issuer end |
#now ⇒ Object
Returns the value of attribute now.
6 7 8 |
# File 'lib/saml/kit/builders/response.rb', line 6 def now @now end |
#reference_id ⇒ Object
Returns the value of attribute reference_id.
6 7 8 |
# File 'lib/saml/kit/builders/response.rb', line 6 def reference_id @reference_id end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
5 6 7 |
# File 'lib/saml/kit/builders/response.rb', line 5 def request @request end |
#sign ⇒ Object
Returns the value of attribute sign.
8 9 10 |
# File 'lib/saml/kit/builders/response.rb', line 8 def sign @sign end |
#status_code ⇒ Object
Returns the value of attribute status_code.
7 8 9 |
# File 'lib/saml/kit/builders/response.rb', line 7 def status_code @status_code end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/saml/kit/builders/response.rb', line 5 def user @user end |
#version ⇒ Object
Returns the value of attribute version.
7 8 9 |
# File 'lib/saml/kit/builders/response.rb', line 7 def version @version end |
Instance Method Details
#build ⇒ Object
44 45 46 |
# File 'lib/saml/kit/builders/response.rb', line 44 def build Saml::Kit::Response.new(to_xml, request_id: request.id) end |
#to_xml ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/saml/kit/builders/response.rb', line 31 def to_xml Signature.sign(sign: sign) do |xml, signature| xml.Response do xml.Issuer(issuer, xmlns: Namespaces::ASSERTION) signature.template(id) xml.Status do xml.StatusCode Value: status_code end assertion(xml, signature) end end end |