lib/saml/kit/builders/assertion.rb in saml-kit-1.0.11 vs lib/saml/kit/builders/assertion.rb in saml-kit-1.0.12
- old
+ new
@@ -14,18 +14,19 @@
@response_builder = response_builder
self.embed_signature = embed_signature
end
def name_id_format
- request.name_id_format
+ request.try(:name_id_format) || Saml::Kit::Namespaces::PERSISTENT
end
def name_id
user.name_id_for(name_id_format)
end
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
@@ -41,14 +42,13 @@
xmlns: Namespaces::ASSERTION,
}
end
def subject_confirmation_data_options
- {
- InResponseTo: request.id,
- NotOnOrAfter: 3.hours.since(now).utc.iso8601,
- Recipient: destination,
- }
+ options = { NotOnOrAfter: 3.hours.since(now).utc.iso8601 }
+ options[:Recipient] = destination if destination.present?
+ options[:InResponseTo] = request.id if request.present?
+ options
end
def conditions_options
{
NotBefore: now.utc.iso8601,