-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use intersection of application and default server scopes #1002 #1086
Conversation
What about other grant flows, ie |
@nbulaj Yes, Other grant flows must work the same way. |
Build scopes (from request, intersection with application scopes or server default) in BaseRequest. Add specs for Client Credentials and Password grant flows.
@rishabhsairawat yep, this is a good strategy. Implemented in 976b235 |
@nbulaj What about other grant flows i.e. And you missed following case for |
I'm currently looking into them.
I will check it tomorrow. |
…r AuthorizationCode and Implicit flow
@nbulaj Checkout following scenario: |
#1086: build scopes intersection in PreAuthorization for AuthorizationCode and Implicit flow
I don't sure if it must work this way. Some endpoints can require OAuth authentication, but without any particular scopes (just to be sure client is authenticated). So if client doesn't request any scopes - he will not get this scopes and can't request something protected with the scopes, but can interact with scopesless endpoints. |
@nbulaj If you want this then I think In following case also, scopeless token and grant should be issued. If intersection of application scopes and default scopes is blank and No scopes are passed in request
|
@rishabhsairawat of I understood you correctly:
then I think it already works this way. context 'when application scopes contain some of the default scopes and no scope is passed' do
before do
client.update_attributes(scopes: 'value1 value2')
end
it 'issues new token with one default scope that are present in application scopes' do
default_scopes_exist :value3
headers = authorization client.uid, client.secret
params = { grant_type: 'client_credentials' }
expect do
post '/oauth/token', params: params, headers: headers
end.to change { Doorkeeper::AccessToken.count }.by(1)
token = Doorkeeper::AccessToken.first
expect(token.application_id).to eq client.id
expect(token.scopes).to be_empty
should_have_json 'access_token', token.token
should_not_have_json 'scope'
end
end |
… of application scopes and default scopes to be blank
…n of application scopes and default scopes to be blank
Ah, thats ok @rishabhsairawat, I've checked only client credentials thinking that every grant works the same way. Thanks! |
#1086: provides scopeless token in case of intersection of applicatio…
…n of application scopes and default scopes to be blank
Summary
This PR aims to solve the issue #1002 .
Reference
Commit b5bf40e by @nbulaj missed the following case:
Default scopes: public, admin
Application scopes: read, write, public
And no scopes are passed.
Expected output: public
Output by b5bf40e : invalid scope