-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
swagger-ui is not mapping oauth2-redirect.html #4766
Comments
I believe that it just needs to set the oauth2RedirectUrl when it modifies the swagger-ui index.html https://swagger.io/docs/open-source-tools/swagger-ui/usage/configuration/. As an aside, it'd be nice to be able to set the validatorUrl. |
@irenakezic this might be a good issue for you. From what I can see, we need to expose Better check beforehand if it's still inaccessible as it's a pretty old issue. |
@gsmet ok thx! I will give it a try but probably not before the weekend. |
@btsibr I tried reproducing this but the Authorize dialog seems to work fine for me. |
Configuring smallrye-openapi like below I have the same issue :
I can successfully login, but am redirect to /oauth2-redirect.html. When I manually prefix this path with /swagger-ui it works. |
I'm having the same problem here. I'm getting redirected to Can I change that within the @Securityscheme annotation somehow? When I change the URL manually, the oauth2-redirect.html file is there (I can view the HMTL source), but authorization won't continue. I'm just looking at an empty page. |
The problem is that the redirect-url is determined in index.js without looking at the URL path:
I did not find any place where I could overwrite this default. This means that Swagger-UI will not work for any path other than '/', correct? |
Ok - this is a top level configuration item for swagger-ui. It must be configured as described here: |
@Agh42 considering we already update the URL in Would you be interested in giving it a try? |
* Temporary workaround to avoid Quarkus issue quarkusio/quarkus#4766 Fix for quarkusio/quarkus#4766 * Add keycloak OAuth2 to the Swagger API
@btsibr Hi, I am trying to configure @Securityscheme with OAUTH2 and authorizationCode, however does not work using Quarkus 1.11.1. I Tried To include the following properties unsuccessful quarkus.swagger-ui.oauth2-redirect-url=http://localhost:8080/api/q/swagger-ui/ Do you know what I missed? |
Hi, I'm having exactly the same issue as @lucas-dclrcq, @viniciusfcf, and @Agh42 @SecurityScheme(
type = SecuritySchemeType.OAUTH2,
securitySchemeName = "Keycloak Dev",
description = "Keycloak Identity and Access Management",
flows = @OAuthFlows(
implicit = @OAuthFlow(
refreshUrl = "http://localhost:8081/auth/realms/h2g/protocol/openid-connect/token",
authorizationUrl = "http://localhost:8081/auth/h2g/master/protocol/openid-connect/auth",
scopes = {
@OAuthScope(
name = "microprofile-jwt",
description = "Microprofile - JWT built-in scope"
),
@OAuthScope(
name = "profile",
description = "OpenID Connect built-in scope: profile"
),
@OAuthScope(
name = "roles",
description = "OpenID Connect scope for add user roles to the access token"
),
@OAuthScope(
name = "email",
description = "OpenID Connect built-in scope: email"
),
@OAuthScope(
name = "web-origins",
description = "OpenID Connect scope for add allowed web origins to the access token"
)
}
)
)
) |
Can you perhaps share a small project that reproduce this? |
Is it basically that the oauth2-redirect.html is missing ? Or have you included it in your project ? I am busy making a change to add that to this extension, but a good test would be to add it to your application. |
@ThoSap - do you perhaps have a small reproducer ? |
@phillip-kruger If I have time I will prepare one today based on https://github.com/quarkusio/quarkus-quickstarts/tree/master/security-keycloak-authorization-quickstart |
@phillip-kruger sorry I did not find the time today to prepare the reproducer. I just manually checked the app.jar of a Quarkus 1.11.2 prod build and found that indeed the file But even if the file would be there, the redirected context should be /q/swagger-ui/oauth2-redirect.html and not /oauth2-redirect.html |
Ok that helps, I'll look at this today, if we make sure |
The above mentioned PR will now include the
We will have to make changes to the swagger-ui project to be able to pass in Hope that help. Please let me know. |
Describe the bug
In Quarkus, swagger-UI sets the redirect_uri for OAUTH2 requests to /oauth2-redirect.html. If this file doesn't exist, the Authorize dialog (after asking for scopes) returns to a 404 page (that includes a suggestion for /webjars/swagger-ui/3.20.9/oauth2-redirect.html).
Quarkus 0.25.0 w/ swagger-ui and smallrye-jwt extensions.
Expected behavior
The authorize dialog successfully returns to swagger-ui with a token.
This can currently be validated by extracting oauth2-redirect.html from the swagger-ui webjar and placing it in src/main/resources/META-INF.
Expectation is that one of the following happens:
Actual behavior
The Authorize dialog (after asking for scopes) returns to a 404 page (that includes a suggestion for /webjars/swagger-ui/3.20.9/oauth2-redirect.html).
To Reproduce
Steps to reproduce the behavior:
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: