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

Check OIDC token type and return 401 for invalid bearer tokens #10811

Merged

Conversation

sberyozkin
Copy link
Member

@sberyozkin sberyozkin commented Jul 17, 2020

Fixes #10717

This PR:

  • adds an optional token type check, and if the property is not set, does check as the last try, that Keycloak issued valid refresh tokens can not be used to get an access. if a RT is sent and is valid, it can be verified successfully.
    In fact, even without this PR, the test would get 403 because RT would have no expected roles (403 in this case is not issued by quarkus-oidc but by the follow up roles checker), but the correct response is not even get the RBAC layer exercised and return 401 immediately since the token is invalid.
  • so I had to fix BearerAuthenticationMechanism, the challenge should really be 401 all the time, 403 implies that the actual token is valid (signature, different verification constraints), only roles are not matching but RBAC is not even enforced yet by the time Challenge is made so it should be 401

@sberyozkin sberyozkin added this to the 1.7.0 - master milestone Jul 17, 2020
@sberyozkin sberyozkin merged commit dd3b5e4 into quarkusio:master Jul 20, 2020
@sberyozkin sberyozkin deleted the refresh_token_instead_of_bearer branch September 16, 2020 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

quarkus-oidc NullPointerException
2 participants