diaspora/app/models/api/openid_connect/pairwise_pseudonymous_identifier.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

22 lines
501 B
Ruby

module Api
module OpenidConnect
class PairwisePseudonymousIdentifier < ActiveRecord::Base
self.table_name = "ppid"
belongs_to :o_auth_application
belongs_to :user
validates :user, presence: true
validates :identifier, presence: true, uniqueness: {scope: :user}
validates :guid, presence: true, uniqueness: true
before_validation :setup, on: :create
private
def setup
self.guid = SecureRandom.hex(16)
end
end
end
end