Skip to content
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

show only endpoint relevant oauth scopes in authorization window #8219

Closed
kai-morich opened this issue Oct 7, 2022 · 1 comment
Closed

Comments

@kai-morich
Copy link
Contributor

Is your feature request related to a problem?

With the upper lock symbol, all possible authorizations are shown. Thats ok.
With the lower lock symbol, the authorizations are already filtered to the types supported by an endpoint, but for oauth, still all scopes are shown

image

Describe the solution you'd like

Should be reduced to the scopes specified at the endpoint (for below example should be admin only for the POST endpoint)

Additional context

minimalistic example:

openapi: 3.0.3
info:
 title: scope test
 version: 0.1.0
servers:
 - url: http://testserver.com
paths:
 /pet/:
   get:
     responses:
       '200':
         description: Successful Response
     security:
       - BasicAuth: []
       - OAuth2: [read] 
   post:
     responses:
       '200':
         description: Successful Response
     security:
       - OAuth2: [admin]
components:
 securitySchemes:
   BasicAuth:
     type: http
     scheme: basic
   OAuth2:
     type: oauth2
     flows:
       clientCredentials:
         tokenUrl: https://api.testserver.com/oauth2/token/
         scopes:
           admin: modify pets in your account
           read: read your pets
@kai-morich
Copy link
Contributor Author

There is a getDefinitionsByNames function that looks like it does filtering on oauth scopes.

export const getDefinitionsByNames = ( state, securities ) => ( { specSelectors } ) => {

It was disabled with #3870, but that PR does not mention a concrete issue.
@shockey, @webron do you remember why?

tim-lai added a commit that referenced this issue Oct 24, 2022
* 'available authorization' popup: only show oauth2 scopes relevant for current endpoint (issue #8219)

* unit tests for oauth2 scope filter

Co-authored-by: Kai Morich <[email protected]>
Co-authored-by: Tim Lai <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant