我正在尝试设置一个需要针对OpenID Connect身份提供程序进行身份验证的反向代理。
然后,用户授予对其数据的反向代理访问权。
只有当用户是特定LDAP组的成员时,才能由用户访问代理后面的某些应用程序。遗憾的是,应用程序是转储,无法自行授权,因此反向代理必须处理该部分。
使用mod_auth_openidc设置身份验证部分并不困难。 我挣扎的是授权部分。我有一个mod_authnz_ldap的工作示例,需要用户名和密码而不是 BasicAuth 。
OpenID Connect的想法是资源服务器(在我的情况下是代理)永远不会知道用户的密码而不必检查它。这被委托给OpenID Connect身份提供商。
所以我没有这种方法所需的密码。我的想法是使用oidc auth创建一个虚拟主机,它拒绝来自客户端的某些标头x-my-oidc-username
,经过身份验证后设置此标头并将请求传递给127.0.0.1
上的另一个vhost绑定,因此无法直接访问它认证。该vhost只将标头作为经过身份验证的用户名并运行LDAP授权。
我还没有看到过跳过ldap模块的Authentication Phase并从其他地方获取用户名的方法,比如OpenID Connect ID Token或我的自定义标头。
任何想法/建议/方法/提示?
答案 0 :(得分:1)
这篇文章介绍了如何将mod_auth_openidc
和mod_authnz_ldap
结合在一起:
https://github.com/pingidentity/mod_auth_openidc/wiki/Authorization#2-mod_authnz_ldap:
OIDCProviderMetadataURL https://accounts.google.com/.well-known/openid-configuration
OIDCClientID <client_id>
OIDCClientSecret <client_secret>
OIDCRedirectURI http://example.com/example/redirect_uri
OIDCScope "openid email profile"
# Set REMOTE_USER to the email address.
# this is the value that mod_authnz_ldap leverages as the first parameter after basedn.
# in the example below, REMOTE_USER = email = mail attribute in LDAP.
OIDCRemoteUserClaim email
<Location /example/>
AuthType openid-connect
AuthLDAPURL "ldap://example.com/ou=people,dc=example,dc=com?mail?sub?(objectClass=*)"
AuthLDAPGroupAttribute member
Require ldap-group cn=myTestAccesss,ou=Groups,dc=example,dc=com
</Location>