Skip to content

OAuth2 Scopes do not render #235

Closed
Closed

Description

@kamaydeo

I don't know if it's a missing features or a bug but OAuth2 scopes don't show up. See Security section in the yaml.

get:
      tags:
        - APIs
      summary: List all Services
      operationId: listApis
      parameters:
        - in: query
          name: page
          schema:
            type: integer
            default: 1
            minimum: 1
          description: The location of page to be searched.
          example: 5
          required: false
        - in: query
          name: size
          schema:
            type: integer
            default: 20
            minimum: 1
            maximum: 2000
          example: 100
          description: Number of records per page.
          required: false
        - in: query
          name: sort
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Page.GetApisResponse'
      security:
        - Bearer:
            - admin
        - OAuth2:
            - admin

Activity

  1. mrin9 commented on Jun 16, 2020

    @mrin9
    Collaborator

    Not sure of what you are expecting in the UI.
    I could see the scopes in the UI under the AUTHENTICATION section
    https://mrin9.github.io/RapiDoc/examples/oauth.html#authentication

  2. kamaydeo commented on Jun 16, 2020

    @kamaydeo
    Author

    Have a look at AUTHORIZATIONS section
    image

  3. mrin9 commented on Jun 17, 2020

    @mrin9
    Collaborator

    thats not scopes those are the security needed by the operation and these seucrity must be defined under security-schemes

    for more info refer to #200 on how RapiDoc shows them

  4. kamaydeo commented on Jun 17, 2020

    @kamaydeo
    Author

    I already have defined security and securitySchemes.

    security:
      - Bearer:
          - write:domain
          - admin
      - OAuth2:
          - write:domain
          - admin

    and

    components:
      securitySchemes:
        Bearer:
          type: apiKey
          description: |
            Bearer scheme uses static perpetual token and is less secure.
            Token has a `write:domain` or `admin` permission associated with it.
            It determines whether you are authorized to invoke a particular operation or not.
          in: header
          name: Authorization
        OAuth2:
          type: oauth2
          description: |
            OAuth2 scheme is  a safer and more secure way to give you access with a short-lived token.
          flows:
            clientCredentials:
              tokenUrl: https://...../oauth2/token
              scopes:
                'write:domain': Manage Services and Subscribers in your Domain
                admin: Manage Services and Subscribers in all Domains

    I would be nice to see what authorizations are available at the individual operation level (which either inherits from global security or operation level security

  5. mrin9 commented on Jun 17, 2020

    @mrin9
    Collaborator

    they should be shown at operation level on top-right corner of each operation (if you have defined them properly)

    image

  6. kamaydeo commented on Jun 17, 2020

    @kamaydeo
    Author

    It does show up in the top right corner of the each operation but it doesn't contain scope information which could be overridden at the operation level by defining security attribute under responses. OAuth2 scopes add more details such as what permissions you need to have in order to invoke this operation. The top right corner just shows what security schemes are available.

  7. added a commit that references this issue on Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions