Commit e69da5a

mo <mo@mokhan.ca>
2017-11-20 17:09:08
request authnrequests to be signed.
1 parent 9cb40e9
lib/saml/kit/identity_provider_metadata.rb
@@ -33,7 +33,7 @@ module Saml
 
       class Builder
         attr_accessor :id, :organization_name, :organization_url, :contact_email, :entity_id, :attributes, :name_id_formats
-        attr_accessor :want_authn_requests_signed, :sign
+        attr_accessor :want_authn_requests_signed, :authn_requests_signed, :sign
         attr_reader :logout_urls, :single_sign_on_urls
 
         def initialize(configuration = Saml::Kit.configuration)
@@ -46,6 +46,7 @@ module Saml
           @configuration = configuration
           @sign = true
           @want_authn_requests_signed = true
+          @authn_requests_signed = true
         end
 
         def add_single_sign_on_service(url, binding: :post)
@@ -112,8 +113,9 @@ module Saml
 
         def idp_sso_descriptor_options
           {
+            AuthnRequestsSigned: authn_requests_signed,
+            WantAuthnRequestsSigned: want_authn_requests_signed,
             protocolSupportEnumeration: Namespaces::PROTOCOL,
-            WantAuthnRequestsSigned: want_authn_requests_signed
           }
         end
       end
spec/saml/identity_provider_metadata_spec.rb
@@ -214,6 +214,7 @@ RSpec.describe Saml::Kit::IdentityProviderMetadata do
       expect(result['EntityDescriptor']['entityID']).to eql(entity_id)
       expect(result['EntityDescriptor']['IDPSSODescriptor']['protocolSupportEnumeration']).to eql(Saml::Kit::Namespaces::PROTOCOL)
       expect(result['EntityDescriptor']['IDPSSODescriptor']['WantAuthnRequestsSigned']).to eql('true')
+      expect(result['EntityDescriptor']['IDPSSODescriptor']['AuthnRequestsSigned']).to eql('true')
       expect(result['EntityDescriptor']['IDPSSODescriptor']['NameIDFormat']).to match_array([
         Saml::Kit::Namespaces::PERSISTENT,
         Saml::Kit::Namespaces::TRANSIENT,