Sha256: df9d7ec41535b5b8cba0fe969d9ebef2f4fd58eb0882871f5a504a9c82c64e13
Contents?: true
Size: 885 Bytes
Versions: 2
Compression:
Stored size: 885 Bytes
Contents
module Doorkeeper module OpenidConnect class UserInfo include ActiveModel::Validations def initialize(resource_owner, scopes) @resource_owner = resource_owner @scopes = scopes end def claims base_claims.merge resource_owner_claims end def as_json(*_) claims.reject { |_, value| value.nil? || value == '' } end private def base_claims { sub: subject } end def resource_owner_claims Doorkeeper::OpenidConnect.configuration.claims.to_h.map do |name, claim| if @scopes.exists? claim.scope [name, claim.generator.call(@resource_owner, @scopes)] end end.compact.to_h end def subject Doorkeeper::OpenidConnect.configuration.subject.call(@resource_owner).to_s end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
doorkeeper-openid_connect-1.1.2 | lib/doorkeeper/openid_connect/user_info.rb |
doorkeeper-openid_connect-1.1.1 | lib/doorkeeper/openid_connect/user_info.rb |