authentication - 如何使用 SPNEGO 和 CAS 获取 LDAP 用户属性?

标签 authentication kerberos cas spnego

使用 CAS 5.3.x 和 SPNEGO (Kerberos) 身份验证,如何获取除 SAMAccountName 之外的更多用户属性?

当我只使用“标准”LDAP 身份验证处理程序时,我可以放置此配置:

cas.authn.ldap[0].principalAttributeList=sAMAccountName,displayName,givenName,mail

但是经过 SPNEGO 身份验证后,我没有获得这些附加属性。

你知道有什么办法吗?

最佳答案

自 3.x 以来,CAS 中就已经具备从外部数据存储获取属性的功能。此功能过去和现在都是由名为 Person Directory 的 Apereo 项目提供的,该项目是一个 Java 框架,用于解析来自各种底层源的人员和属性。它由一组组件组成,用于从 JDBC、LDAP 等检索、缓存、解析、聚合和合并人员属性。 CAS 尝试通过名为 PrincipalResolver 的概念来利用此框架,其目标是为 CAS 构建最终可识别的经过身份验证的主体,其中包含从属性存储库源获取的许多属性。这意味着,例如,人们可以在一个查询中使用 SPNEGO 进行身份验证,然后使用 Ask LDAP、关系数据库和 Groovy 脚本来获取已解析主体的属性,并将所有结果合并到最终集合中。

请注意,在大多数情况下,例如直接 LDAP 身份验证,并且从 CAS 4.x 开始,身份验证引擎已得到增强,能够从身份验证源检索和解析属性,这将消除对配置单独的属性存储库/解析器,特别是在身份验证和属性源相同的情况下。仅当源不同或需要处理更高级的属性解析用例(例如级联、合并等)时,才需要使用单独的解析器和源。

要将 CAS 配置为对属性存储库使用外部 LDAP,请使用:

cas.authn.attribute-repository.ldap[0].attributes.uid=uid
cas.authn.attribute-repository.ldap[0].attributes.displayName=displayName
cas.authn.attribute-repository.ldap[0].attributes.cn=commonName
cas.authn.attribute-repository.ldap[0].attributes.memberOf=memberOf

cas.authn.attribute-repository.ldap[0].ldapUrl=ldap://...
cas.authn.attribute-repository.ldap[0].useSsl=false
cas.authn.attribute-repository.ldap[0].useStartTls=false
cas.authn.attribute-repository.ldap[0].baseDn=dc=example,dc=edu
cas.authn.attribute-repository.ldap[0].searchFilter=uid={0}
cas.authn.attribute-repository.ldap[0].bindDn=...
cas.authn.attribute-repository.ldap[0].bindCredential=...

关于authentication - 如何使用 SPNEGO 和 CAS 获取 LDAP 用户属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61050686/

相关文章:

asp.net-mvc - 如何在 Visual Studio 2012 中使用 ASP.NET Identity 创建一个新的 MVC 5 项目?

tomcat - "PKIX path building failed"分布式CAS应用程序在单独的Tomcat实例上时出现异常

php - 如何在 PHP 中使用登录 cookie 连接用户?

swift - 是否可以自定义 fabric Twitter 登录按钮的大小?

java - 如何存储 Android 的单用户登录数据?

java - 如何从 Java 连接到需要 Windows 客户端身份验证的 REST 服务?

spring-mvc - 使用 kerberos/spnego 身份验证的 spring 安全性

scala - 无法使用 IntelliJ 在本地连接到 hdfs kerberized 集群

java - Apereo Cas - 自定义主体 ID 发布

single-sign-on - 不认可的cas票