Class: Saml::Kit::Builders::Assertion
- Inherits:
-
Object
- Object
- Saml::Kit::Builders::Assertion
- Includes:
- XmlTemplatable
- Defined in:
- lib/saml/kit/builders/assertion.rb
Overview
This class is responsible for building a SAML Assertion
Constant Summary
Constants included from XmlTemplatable
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
-
#default_name_id_format ⇒ Object
Returns the value of attribute default_name_id_format.
-
#destination ⇒ Object
Returns the value of attribute destination.
-
#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.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #assertion_attributes ⇒ Object
- #build ⇒ Object
-
#initialize(user, request, configuration: Saml::Kit.configuration) ⇒ Assertion
constructor
A new instance of Assertion.
- #name_id ⇒ Object
- #name_id_format ⇒ Object
Methods included from XmlTemplatable
#digest_method, #sign?, #signature_method, #signing_key_pair, #template_name, #template_path
Constructor Details
#initialize(user, request, configuration: Saml::Kit.configuration) ⇒ Assertion
Returns a new instance of Assertion.
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/saml/kit/builders/assertion.rb', line 17 def initialize(user, request, configuration: Saml::Kit.configuration) @user = user @request = request @configuration = configuration @issuer = configuration.entity_id @reference_id = ::Xml::Kit::Id.generate @version = '2.0' @now = Time.now.utc self.default_name_id_format = Saml::Kit::Namespaces::UNSPECIFIED_NAMEID end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
11 12 13 |
# File 'lib/saml/kit/builders/assertion.rb', line 11 def configuration @configuration end |
#default_name_id_format ⇒ Object
Returns the value of attribute default_name_id_format.
15 16 17 |
# File 'lib/saml/kit/builders/assertion.rb', line 15 def default_name_id_format @default_name_id_format end |
#destination ⇒ Object
Returns the value of attribute destination.
13 14 15 |
# File 'lib/saml/kit/builders/assertion.rb', line 13 def destination @destination end |
#issuer ⇒ Object
Returns the value of attribute issuer.
14 15 16 |
# File 'lib/saml/kit/builders/assertion.rb', line 14 def issuer @issuer end |
#now ⇒ Object
Returns the value of attribute now.
13 14 15 |
# File 'lib/saml/kit/builders/assertion.rb', line 13 def now @now end |
#reference_id ⇒ Object
Returns the value of attribute reference_id.
12 13 14 |
# File 'lib/saml/kit/builders/assertion.rb', line 12 def reference_id @reference_id end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
11 12 13 |
# File 'lib/saml/kit/builders/assertion.rb', line 11 def request @request end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
11 12 13 |
# File 'lib/saml/kit/builders/assertion.rb', line 11 def user @user end |
#version ⇒ Object
Returns the value of attribute version.
14 15 16 |
# File 'lib/saml/kit/builders/assertion.rb', line 14 def version @version end |
Instance Method Details
#assertion_attributes ⇒ Object
36 37 38 39 40 |
# File 'lib/saml/kit/builders/assertion.rb', line 36 def assertion_attributes return {} unless user.respond_to?(:assertion_attributes_for) user.assertion_attributes_for(request) end |
#build ⇒ Object
42 43 44 |
# File 'lib/saml/kit/builders/assertion.rb', line 42 def build Saml::Kit::Assertion.new(to_xml, configuration: configuration) end |
#name_id ⇒ Object
32 33 34 |
# File 'lib/saml/kit/builders/assertion.rb', line 32 def name_id user.name_id_for(name_id_format) end |
#name_id_format ⇒ Object
28 29 30 |
# File 'lib/saml/kit/builders/assertion.rb', line 28 def name_id_format request.try(:name_id_format) end |