Open ggam opened 4 years ago
Hi, This is worked as designed. If you have a need to allow fallback from MP JWT to JSR-375 BasicAuth, you need to open an RFE https://www.ibm.com/developerworks/rfe/execute?use_case=submitRfe so other customers can vote it.
Thanks, Ut Le
Hi @utle. I'll create a RFE (thanks for the link) but let me clarify my use case. I'm really trying to use JSR 375 for the IdentityStore, as I don't want to implement a Liberty UserRegistry, which is non portable.
Fallback to basic auth is supported, but only when using <login-config>
, which delegates to server user registries.
Is there any other way to achieve that?
Hi @ggam, no.
We had the same issue and unfortionally we got also the answer that it works as designed. https://github.com/OpenLiberty/open-liberty/issues/11058
I think it is not the best solution because if you use a HttpAutenticationMechanism features like mpJwt and social logins does not work anymore ....
Describe the bug
I'm trying to use Jakarta EE Security for authenticating users via basic auth and via JWT afterwards. The problem is that Jakarta EE Security seems to always take precedence over MP JWT, efectively disabling it. Liberty always takes Jakarta EE Security for authentication.
Steps to Reproduce server.xml with MP JWT filtered for "Authorization Bearer" requests (removing the filter doesn't fix the problem anyway)
AuthConfig.java
web.xml
With this configuration, I do a Postman request to http://localhost:9080/resources with header "Authorization Bearer XXXX" and I get the following messages.log entry:
I then remove
@BasicAuthenticationMechanismDefinition(realmName = "defaultRealm")
to disable Jakarta Security. The same requests (invalid token) gives the following result:Expected behavior Jakarta Security should authenticate the user when there's no "Authorization Bearer" header present. MP JWT should be used when there is.
Diagnostic information: