Commit 46c66fd

mo <mo@mokhan.ca>
2018-08-09 21:57:01
extract nameid format from response.
1 parent 165e38c
Changed files (2)
lib
spec
lib/saml/kit/assertion.rb
@@ -45,6 +45,10 @@ module Saml
         at_xpath('./saml:Subject/saml:NameID').try(:text)
       end
 
+      def name_id_format
+        at_xpath('./saml:Subject/saml:NameID').attribute("Format").try(:value)
+      end
+
       def signed?
         signature.present?
       end
spec/saml/kit/assertion_spec.rb
@@ -13,6 +13,7 @@ RSpec.describe Saml::Kit::Assertion do
 
   specify { expect(subject.issuer).to eql(entity_id) }
   specify { expect(subject.name_id).to eql(user.name_id) }
+  specify { expect(subject.name_id_format).to eql(Saml::Kit::Namespaces::PERSISTENT) }
   specify { expect(subject.started_at.to_i).to eql(Time.now.utc.to_i) }
   specify { expect(subject.expired_at.to_i).to eql(Saml::Kit.configuration.session_timeout.since(Time.now).utc.to_i) }
   specify { expect(subject.attributes).to eql('id' => user.attributes[:id]) }