quarkus: Quarkus Oauth2 quarkus.oauth2.enabled doesn't seem to work
Describe the bug
Setting this quarkus.oauth2.enabled=false doesnt “disable” the oauth2 features. I need to comment out my annotations about “@RolesAllowed” to disable oauth verification.
Expected behavior
Setting this quarkus.oauth2.enabled=false only, would make all security “checks” disabled so i don’t need to comment out any other code lines.
Actual behavior
Setting this quarkus.oauth2.enabled=false doesnt “disable” the oauth2 features. I need to comment out my annotations about “@RolesAllowed” to disable oauth verification.
To Reproduce Steps to reproduce the behavior:
- Set this property:
quarkus.oauth2.enabled=false - Add a @RolesAllowed(“anything”) on a route.
- Request this route.
- You will get a 403.
Environment (please complete the following information):
- Output of
uname -aorver: - Output of
java -version: 11 - GraalVM version (if different from Java): –
- Quarkus version or git rev: 1.5.2.FINAL
- Build tool (ie. output of
mvnw --versionorgradlew --version): 3.6.3
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 26 (21 by maintainers)
Of course! 😃
I’d say so, I believe we’ve had a good number of similar queries, not sure where, may be at https://quarkus.io/guides/security to start with, have a section
How to Disable Authorization. I think it should show the injection of the custom property likeauthorization-enabledto highlight the point Stuart made, @ejba Hi, are you Ok with doing another PR 😃 ?So you can do it at runtime as well, but it requires some custom code:
Including this bean in your application will disable security. If you want to make it configurable just make it inject a configuration property using MP config.
I am a bit hesitant about including this as a general config option, it just feels a bit dangerous.
@ejba
Right this or any other extension dealing with the authentication is only populating a
Securityidentity. RBAC level is in the next phase. If one disablesoauth2/etc then all what is being achieved is that no auth mechanism is available which can do something meaningful withBearer sometoken.I wonder though if the time has come to introduce a property like a default role (someone has suggested it already). Or have a property like
disable-role-based-access-control… Or how aboutproactive-authorization=falsewhich will be disable RBAC ifSecurityIdentityis not available…CC @stuartwdouglas Hi Stuart, what do you think ?
Le’s see first if this is just a misuse issue