Commit 35a46fe
2017-11-06 03:24:25
1 parent
0afcfbf
Changed files (2)
proof
app
models
saml-kit
lib
saml
kit
proof/app/models/user.rb
@@ -4,6 +4,14 @@ class User < ApplicationRecord
self.uuid = SecureRandom.uuid unless self.uuid
end
+ def name_id_for(request)
+ if Saml::Kit::Namespaces::PERSISTENT == request.name_id_format
+ uuid
+ else
+ email
+ end
+ end
+
def assertion_attributes_for(request)
{
id: uuid,
saml-kit/lib/saml/kit/response.rb
@@ -213,7 +213,7 @@ module Saml
xml.Assertion(assertion_options) do
xml.Issuer configuration.issuer
xml.Subject do
- xml.NameID user.name_id_for(request.name_id_format), Format: request.name_id_format
+ xml.NameID user.name_id_for(request), Format: request.name_id_format
xml.SubjectConfirmation Method: Namespaces::BEARER do
xml.SubjectConfirmationData "", subject_confirmation_data_options
end