ePages-de / restdocs-api-spec

Adds API specification support to Spring REST Docs
MIT License
391 stars 103 forks source link

OpenAPI 3 oauth2 security scheme not applied globally for all endpoints #240

Open toedter opened 1 year ago

toedter commented 1 year ago

When providing an OpenAPI 3 security scheme, like

openapi3 {
    server = 'https://myserver.com/api'
    title = 'My API'
    description = 'My api description'
    version = '0.5.0'
    format = 'yaml'
    oauth2SecuritySchemeDefinition = {
        flows = ['authorizationCode']
        tokenUrl = 'https://myauthserver.com/oauth/token'
        authorizationUrl = 'https://myauthserver.com/authorize'
    }
}

the securitySchemes is created correctly in the openapi3.yaml.

But to apply it to all endpoints, an additional (top-level) entry like

security:
  - oauth2: []

would be needed.

I did not find a way to create this entry.