Proxying to External Keycloak Auth Protected API Endpoint? #520
-
I'm trying (desperately) to set this up for a reverse proxy (using mod_proxy) from a Docker container running behind SSL termination. I'm certain that I am very close but close doesn't count for much. Here is my current config (edited to remove identifying data): <VirtualHost *:80>
ServerName api.test.dev.env
ProxyPreserveHost Off
RequestHeader set X-Forwarded-Proto "https" early
RequestHeader set X-Forwarded-Port 443 early
# SSL setup for backend HTTPS endpoints
SSLProxyEngine On
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
SSLHonorCipherOrder On
SSLCompression Off
SSLSessionTickets Off
OIDCProviderMetadataURL "https://auth.external.com/auth/realms/<realm>/.well-known/openid-configuration"
OIDCClientID "<clientid_key"
OIDCClientSecret "<client_secret>"
OIDCRedirectURI "https://api.test.dev.env/openid" # This doesn't actually exist anywhere
OIDCProviderTokenEndpointAuth client_secret_basic # From https://github.com/zmartzone/mod_auth_openidc/wiki/Keycloak
OIDCCryptoPassphrase 3KpAHrxjYoIXvye14xjU # Random string
OIDCScope "CUSTOM.SCOPE" # We use a custom scope provided by the external provider.
LogLevel auth_openidc:debug
ProxyPass "/" "https://apisandbox.external.com/" retry=0 connectiontimeout=2700 timeout=2700 Keepalive=On
ProxyPassReverse "/" "https://apisandbox.external.com/"
ProxyRequests Off
AllowEncodedSlashes On
<Proxy "*">
AuthType openid-connect
Require valid-user
</Proxy>
</VirtualHost> From there, using Postman, I try to hit a simple GET endpoint (for example: https://api.test.dev.env/things) that should return a json document with some data in it. But instead, I get: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Error</title>
</head>
<body>
<p>Error:
<pre>OpenID Connect Provider error: unauthorized_client</pre>
</p>
<p>Description:
<pre>Client+is+not+allowed+to+initiate+browser+login+with+given+response_type.+Standard+flow+is+disabled+for+the+client.</pre>
</p>
</body>
</html> Digging further around through Google isn't turning up anything really useful, does anyone have any advice here? Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
it's really a Keycloak question but I believe that the configuration for your client |
Beta Was this translation helpful? Give feedback.
it's really a Keycloak question but I believe that the configuration for your client
clientid_key
in Keycloak should be modified to allow the Authorization Code grant type