Replies: 1 comment
-
I fixed it by adding OIDCOAuthVerifyJwksUri to the config. Shouldn't that be covered by the keycloak metadata url? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello.
I've set up mod_auth_openidc on RHEL9 using mod_auth_openidc-2.4.16.11-1.el9.x86_64.rpm from the releases page.
I'm using keycloak from red hat 26.0.10.
I've configured apache according to the wiki, with the exception of AuthType auth-openidc instead of openid-connect, which is specified in the wiki: https://github.com/OpenIDC/mod_auth_openidc/wiki/Single-Page-Applications#allowing-both-oauth-20-and-openid-connect
I want to have locations in apache protected by keycloak to allow both browser access and programmatic access.
Here is my auth_openidc.conf file:
I am testing programmatic access by using curl to get an access token:
curl -X POST -d grant_type=password -d username={username} -d password={password} -d client_id={client_id} -d client_secret={client_secret} https://{keycloak FQDN}/realms/{realm}/protocol/openid-connect/token
I then try to access the protected resource by providing the token in an Authorization header:
Authorization: Bearer {access_token}
I get an error from Apache in the www-authenticate header:
www-authenticate: Bearer error="invalid_token", error_description="JWT token could not be validated"
And the ssl_error_log shows this:
So I went to jwt.io and pasted my access token and the json object for the key with id ZtyywKfNUM8d7lNDzhod8RbMctSanzv8B9RCa42AP_M which I got from the jwks_uri (which I got from /.well-known/openid-configuration) and it shows valid public key.
I don't understand why mod_auth_openidc can't validate the token.
[edit]
I set my apache log level to debug and now see the following:
I don't understand this. The metadata URL absolutely has jwks_uri set. I also tested adding the following configuration option:
OIDCProviderJwksUri https://{keycloak backend fqdn}:8443/realms/{realm}/protocol/openid-connect/certs
And it still shows the same error saying JWKs URI set to (null)
Beta Was this translation helpful? Give feedback.
All reactions