diaspora/lib/api/openid_connect/subject_identifier_creator.rb
theworldbright a76f51a6a5 Use redirect_uri if no sector identifier for ppid
As according to http://openid.net/specs/openid-connect-core-1_0.html#PairwiseAlg:

"If the Client has not provided a value for
sector_identifier_uri in Dynamic Client Registration
[OpenID.Registration], the Sector Identifier used
for pairwise identifier calculation is the host
component of the registered redirect_uri."
2016-01-04 16:49:55 +09:00

17 lines
562 B
Ruby

module Api
module OpenidConnect
class SubjectIdentifierCreator
def self.createSub(auth)
if auth.o_auth_application.ppid?
identifier = auth.o_auth_application.sector_identifier_uri ||
URI.parse(auth.o_auth_application.redirect_uris[0]).host
pairwise_pseudonymous_identifier =
auth.user.pairwise_pseudonymous_identifiers.find_or_create_by(identifier: identifier)
pairwise_pseudonymous_identifier.guid
else
auth.user.diaspora_handle
end
end
end
end
end