Module: Api::OpenidConnect::SubjectIdentifierCreator

Defined in:
lib/api/openid_connect/subject_identifier_creator.rb

Class Method Summary collapse

Class Method Details

.create(auth) ⇒ Object


6
7
8
9
10
11
12
13
14
15
16
# File 'lib/api/openid_connect/subject_identifier_creator.rb', line 6

def self.create(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