-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Quarkus tries to use client_credentials grant type when calling for JWT token to Keycloak, while it should use authorization_code. #5323
Comments
@piotrgwiazda AFAIK, no Keycloak specific API is used by |
@piotrgwiazda FYI, I've confirmed the tests work without KC specific APIs being on the classpath, so can you create a reproducer ? For example, using that quickstart as a base ? |
Based on some tutorial I had |
@piotrgwiazda might be related. Note, you don't need |
@sberyozkin I've followed this tutorial https://quarkus.io/guides/security-keycloak-authorization then I've changed the application type to "web-app" to try another approach. My dependencies are <dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-oidc</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-keycloak-authorization</artifactId>
</dependency>
</dependencies> When I removed <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-keycloak-authorization</artifactId>
</dependency> and removed Also, using this tutorial seems to be a better idea in my case : https://quarkus.io/guides/security-openid-connect I think you can close the issue, unless this indicates a problem somewhere else. Thanks for help. |
@piotrgwiazda thanks, I'll keep it open as the policy enforcer should either work with the id tokens in this case or if it only works with Hi Pedro @pedroigor - what do you think - I guess the simplest approach is probably add a check if the application type is |
The However, we only advertize in guides and cover in our testsuite the bearer token scenario, typical for I can review this and make sure we can deal with |
@pedroigor thanks; @piotrgwiazda had What do you mean it has to be a confidential client, the web-app is a confidential client, right ? The configuration reported by the user has it all set up, And which token |
Yes, the client in Keycloak should be configured to enable You have a good point in regards to the token the extension should use. It should use access token (although the token endpoint also allow using ID Tokens). Based on what I mentioned before about initially supporting bearer tokens ( I did some tests here is this change should be enough to get it also working for |
@pedroigor Hey Pedro, but I wonder if we should leave it as is for the moment and keep |
@sberyozkin It works for me too. Let's wait for any demand from the community. It does make sense though, as you may want to externalize authorization from your web app. The fact that the client should be confidential is perfectly fine since web-apps are server-side apps that can securely store credentials. I'm going to prepare a PR to include checks for the |
I generally agree. On the other hand, sometimes you want to e.g. hide the button if rhe user is missin a permission. Then the backend-for-frontend (web-app) will need the permission details to pass to the GUI. |
[fixes #5323] - Only SERVICE type applications are supported
Describe the bug
Quarkus tries to use client_credentials grant type when calling for JWT token to Keycloak, while it should use authorization_code.
Expected behavior
Quarkus should follow the Authorization Code Grant flow to authorize the user using OAuth 2.0
Actual behavior
The error in Keycloak is:
Why Quarkus tries to use "grant_type=client_credentials"? It should use the grant type = "authorization_code". This looks like a bug in Quarkus, but maybe there is a flag.
To Reproduce
Follow the mentioned steps
Configuration
Screenshots
(If applicable, add screenshots to help explain your problem.)
Environment (please complete the following information):
uname -a
orver
:java -version
:Additional context
https://auth0.com/docs/api-auth/tutorials/authorization-code-grant#2-exchange-the-authorization-code-for-an-access-token
The text was updated successfully, but these errors were encountered: