1

我正在尝试设置需要使用OpenID Connect身份提供程序进行身份验证的反向代理服务器。Apache2反向代理服务器,通过OpenID连接进行身份验证并通过ldap进行授权

然后,用户授予其数据的反向代理访问权限。

代理背后的一些应用程序只有在用户是特定LDAP组的成员时才可以访问。可悲的是,应用程序是转储并且无法授权,因此反向代理必须处理该部分。

mod_auth_openidc设置认证部分并不困难。 我与之奋斗的是授权部分。我有一个mod_authnz_ldap工作示例,需要用户名和密码BasicAuth

与OpenID Connect的想法是资源服务器(在我的情况下代理)永远不会知道用户的密码,不必检查它。这被委托给OpenID Connect身份提供商。

所以我没有这种方法所需的密码。我的想法是创建一个带有oidc auth的虚拟主机,它拒绝来自客户端的一些标头,如x-my-oidc-username,设置此标头一旦通过验证并将请求传递给127.0.0.1上的另一个虚拟主机绑定,因此无法直接通过身份验证直接访问它。该虚拟主机仅将头部作为经过身份验证的用户名并运行LDAP授权。

我还没有看到一种方法可以跳过ldap模块的Authentication Phase,并从其他地方(比如OpenID Connect ID令牌)或从我的自定义标头获取用户名。

任何想法/建议/方法/提示?

回答

1

有一篇文章,介绍如何结合mod_auth_openidcmod_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> 
相关问题