lib/saml/kit/builders/assertion.rb in saml-kit-1.0.23 vs lib/saml/kit/builders/assertion.rb in saml-kit-1.0.24
- old
+ new
@@ -5,21 +5,25 @@
module Builders
# This class is responsible for building a SAML Assertion
# {include:file:lib/saml/kit/builders/templates/assertion.builder}
class Assertion
include XmlTemplatable
- extend Forwardable
- def_delegators :@response_builder,
- :request, :issuer, :reference_id, :now, :configuration, :user,
- :version, :destination
-
+ attr_reader :user, :request, :configuration
+ attr_accessor :reference_id
+ attr_accessor :now, :destination
+ attr_accessor :issuer, :version
attr_accessor :default_name_id_format
- def initialize(response_builder, embed_signature)
- @response_builder = response_builder
- self.embed_signature = embed_signature
+ 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
def name_id_format
request.try(:name_id_format)
@@ -32,11 +36,11 @@
def assertion_attributes
return {} unless user.respond_to?(:assertion_attributes_for)
user.assertion_attributes_for(request)
end
- def signing_key_pair
- super || @response_builder.signing_key_pair
+ def build
+ Saml::Kit::Assertion.new(to_xml, configuration: configuration)
end
private
def assertion_options