main
 1# frozen_string_literal: true
 2
 3xml.Assertion(assertion_options) do
 4  xml.Issuer issuer
 5  signature_for(reference_id: reference_id, xml: xml)
 6  xml.Subject do
 7    xml.NameID name_id, name_id_options
 8    xml.SubjectConfirmation Method: Saml::Kit::Namespaces::BEARER do
 9      xml.SubjectConfirmationData '', subject_confirmation_data_options
10    end
11  end
12  xml.Conditions conditions_options do
13    if request.present?
14      xml.AudienceRestriction do
15        xml.Audience request.issuer
16      end
17    end
18  end
19  xml.AuthnStatement authn_statement_options do
20    xml.AuthnContext do
21      xml.AuthnContextClassRef Saml::Kit::Namespaces::PASSWORD
22    end
23  end
24  if assertion_attributes.any?
25    xml.AttributeStatement do
26      assertion_attributes.each do |key, value|
27        xml.Attribute Name: key do
28          if value.respond_to?(:each)
29            value.each do |x|
30              xml.AttributeValue x.to_s
31            end
32          else
33            xml.AttributeValue value.to_s
34          end
35        end
36      end
37    end
38  end
39end