Prevent duplicate scopes in authorization
This commit is contained in:
parent
054e421829
commit
858e8c2503
2 changed files with 2 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
module Api
|
module Api
|
||||||
module OpenidConnect
|
module OpenidConnect
|
||||||
class OAuthApplication < ActiveRecord::Base
|
class OAuthApplication < ActiveRecord::Base
|
||||||
has_many :authorizations
|
has_many :authorizations, dependent: :destroy
|
||||||
has_many :user, through: :authorizations
|
has_many :user, through: :authorizations
|
||||||
|
|
||||||
validates :client_id, presence: true, uniqueness: true
|
validates :client_id, presence: true, uniqueness: true
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ module Api
|
||||||
auth = OpenidConnect::Authorization.find_or_create_by(
|
auth = OpenidConnect::Authorization.find_or_create_by(
|
||||||
o_auth_application: @o_auth_application, user: @user, redirect_uri: @redirect_uri)
|
o_auth_application: @o_auth_application, user: @user, redirect_uri: @redirect_uri)
|
||||||
auth.nonce = req.nonce
|
auth.nonce = req.nonce
|
||||||
auth.scopes << @scopes
|
auth.scopes << @scopes unless auth.scopes == @scopes
|
||||||
handle_approved_response_type(auth, req, res)
|
handle_approved_response_type(auth, req, res)
|
||||||
res.approve!
|
res.approve!
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue