反向代理下的Keycloak / mod_auth_openidc

时间:2019-05-14 09:27:08

标签: keycloak mod-auth-openidc

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

配置成功。现在,我的问题是,即使我的应用程序(Gitbucket和Jenkins)对我的mod_auth_openidc使用相同的领域,我仍然需要登录该应用程序(SSO设置),即使在访问登录页面时已通过验证。请在链接上查看图片:https://ibb.co/VND01SYhttps://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的注销位置。

1 个答案:

答案 0 :(得分:0)

Jenkins和Gitbucket的

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