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

Fix #1765: NextStep: Missing securitySchemes in swagger #1767

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

jnpsk
Copy link
Collaborator

@jnpsk jnpsk commented Feb 4, 2025

When the Next Step is configured with powerauth.nextstep.security.auth.type=OIDC, it is expected an access token is included in the request header. This PR enhances the generated swagger, when the auth type is set to OIDC as follows:

security:
    - bearerAuth: []
    
components:
    securitySchemes:
        bearerAuth:
            type: http
            scheme: bearer
            bearerFormat: JWT

In case of powerauth.nextstep.security.auth.type=NONE (by default), no change is visible.

@zcgandcomp
Copy link
Member

Question: this will apply the security to all endpoints (in swagger). The /api/service/status is always permitted, but we can probably ignore this...

@@ -72,6 +73,7 @@ public void setBuildProperties(BuildProperties buildProperties) {
* Controller resource with system information.
* @return System status info.
*/
@SecurityRequirements
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This annotation overrides the global security requirement settings in swagger. It adds security: [] for the endpoint, which stands for no security.

"/api/service/status": {
    "get": {
        "responses": {
            ...
        },
        "security": []
    }
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, after double-check, the security: [] is present also in the case of powerauth.nextstep.security.auth.type=NONE for the particular endpoint only. If we would like to avoid specifying "no security" for the endpoint, when globally there is no security required, it would be necessary to solve it dynamically too.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not "nice", but technically correct there is no security for this endpoint. So we can use it.

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

Successfully merging this pull request may close these issues.

2 participants