首页 > 解决方案 > 反向代理下的keycloak/mod_auth_openidc

问题描述

我的 openid 有一个登录页面,如果尚未授权,它将重定向到 Keycloak,然后在验证后重定向到我的登录页面。我在 Apache mod_proxy 下使用了我的 keycloak 服务器。

配置成功。现在,我的问题是,即使我的应用程序(Gitbucket 和 Jenkins)对我的 mod_auth_openidc 使用相同的领域,我仍然需要登录应用程序(SSO 设置),即使我在访问我的登录页面时已经过验证。请查看链接上的图片:https ://ibb.co/VND01SY !https://ibb.co/VND01SY

    DocumentRoot "/var/www/html"
    DirectoryIndex index.html index. cgi index.php index.shtml

    <Proxy "balancer://apache_mod_proxy">
            BalancerMember "http://192.168.122.125:8080"
    </Proxy>

    ProxyPreserveHost On
    ProxyPass "/auth/" "balancer://apache_mod_proxy/auth/"
    ProxyPassReverse "/auth/" "balancer://apache_mod_proxy/auth/"

    OIDCProviderMetadataURL "http://192.168.122.103/auth/realms/ci/.well-known/openid-configuration"
    OIDCClientID "apache24"
    OIDCClientName "apache24"
    OIDCClientSecret "cc251291-9254-42ef-8073-6f5b396f73cc"
    OIDCScope "openid email profile"
    OIDCProviderTokenEndPointAuth "client_secret_basic"

    OIDCRedirectURI http://192.168.122.103/test/redirect_uri
    OIDCCryptoPassphrase 0123456789
    OIDCRemoteUserClaim "preferred_username"

    <Location /test>
       AuthType openid-connect
       Require valid-user
    </Location>

^这是我目前的配置。

我的预期输出应该是:

如果尚未通过 Keycloak 验证: 1. 访问 index.html -> 如果第一次登录,则重定向到 Keycloak 2. 验证后重定向到 index.html(其中包含指向 Jenkins 和 Gitbucket 的链接) 3. 单击应用程序链接时,我不需要重新登录同一个领域。

如果我对场景的理解是正确的,请纠正我。

我也不知道如何使用注销以及登录页面和 SSO 的注销位置。

标签: keycloakmod-auth-openidc

解决方案


SSO 到 Jenkins 和 Gitbucket 取决于如何配置这些应用程序以识别用户。它们应该配置为依赖于在其前面运行 mod_auth_openidc 的反向代理设置的标头。


推荐阅读