summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo <mo@mokhan.ca>2018-10-17 10:51:53 -0600
committermo <mo@mokhan.ca>2018-10-17 10:51:53 -0600
commit324e42962fc521b7ce41479940b0b88e36490fd5 (patch)
treee3b46c44592477a55493b3d14ec5218891d9b554
parent14ca9e8ca87c1e1c3c554ad53738e38f450608d3 (diff)
support attribute arraysv1.0.25
-rw-r--r--lib/saml/kit/builders/templates/assertion.builder8
-rw-r--r--lib/saml/kit/version.rb2
-rw-r--r--spec/saml/kit/builders/response_spec.rb5
3 files changed, 12 insertions, 3 deletions
diff --git a/lib/saml/kit/builders/templates/assertion.builder b/lib/saml/kit/builders/templates/assertion.builder
index 620370e..68d72db 100644
--- a/lib/saml/kit/builders/templates/assertion.builder
+++ b/lib/saml/kit/builders/templates/assertion.builder
@@ -25,7 +25,13 @@ xml.Assertion(assertion_options) do
xml.AttributeStatement do
assertion_attributes.each do |key, value|
xml.Attribute Name: key do
- xml.AttributeValue value.to_s
+ if value.respond_to?(:each)
+ value.each do |x|
+ xml.AttributeValue x.to_s
+ end
+ else
+ xml.AttributeValue value.to_s
+ end
end
end
end
diff --git a/lib/saml/kit/version.rb b/lib/saml/kit/version.rb
index 05e54d8..f78a016 100644
--- a/lib/saml/kit/version.rb
+++ b/lib/saml/kit/version.rb
@@ -2,6 +2,6 @@
module Saml
module Kit
- VERSION = '1.0.24'.freeze
+ VERSION = '1.0.25'.freeze
end
end
diff --git a/spec/saml/kit/builders/response_spec.rb b/spec/saml/kit/builders/response_spec.rb
index a9ef608..a9f845e 100644
--- a/spec/saml/kit/builders/response_spec.rb
+++ b/spec/saml/kit/builders/response_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe Saml::Kit::Builders::Response do
end
let(:email) { FFaker::Internet.email }
let(:assertion_consumer_service_url) { FFaker::Internet.uri('https') }
- let(:user) { User.new(attributes: { email: email, created_at: Time.now.utc.iso8601 }) }
+ let(:user) { User.new(attributes: { email: email, created_at: Time.now.utc.iso8601, roles: ['husband', 'father', 'programmer'] }) }
let(:request) { instance_double(Saml::Kit::AuthenticationRequest, id: Xml::Kit::Id.generate, assertion_consumer_service_url: assertion_consumer_service_url, issuer: issuer, name_id_format: Saml::Kit::Namespaces::EMAIL_ADDRESS, provider: provider, trusted?: true, signed?: true) }
let(:provider) { instance_double(Saml::Kit::ServiceProviderMetadata, want_assertions_signed: false, encryption_certificates: [configuration.certificates(use: :encryption).last]) }
let(:issuer) { FFaker::Internet.uri('https') }
@@ -110,6 +110,9 @@ RSpec.describe Saml::Kit::Builders::Response do
expect(hash['Response']['Assertion']['AttributeStatement']['Attribute'][1]['Name']).to eql('created_at')
expect(hash['Response']['Assertion']['AttributeStatement']['Attribute'][1]['AttributeValue']).to be_present
+
+ expect(hash['Response']['Assertion']['AttributeStatement']['Attribute'][2]['Name']).to eql('roles')
+ expect(hash['Response']['Assertion']['AttributeStatement']['Attribute'][2]['AttributeValue']).to match_array(['husband', 'father', 'programmer'])
end
it 'does not add a signature when the SP does not want assertions signed' do