spring - Spring Active Directory 测试用例,用户名采用 UPN 格式 username@domain
问题描述
对于我的 spring 活动目录测试用例,如果使用 UPN 格式的用户名,username@domain
它会失败并给出以下异常,但同样适用CN=username,OU=Users,DC=internal,DC=test,DC=com
Caused by: javax.naming.InvalidNameException: [LDAP: error code 34 - Unable to parse bind DN 'usename@internal.test.com': Unable to parse string 'usename@internal.test.com' as a DN because it does not have an equal sign after RDN attribute 'usename@internal.test.com'.]
at java.naming/com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3099)
at java.naming/com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2890)
at java.naming/com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2804)
at java.naming/com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:320)
at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:192)
at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:210)
at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:153)
at java.naming/com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:83)
at java.naming/javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:730)
at java.naming/javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
at java.naming/javax.naming.InitialContext.init(InitialContext.java:236)
at java.naming/javax.naming.ldap.InitialLdapContext.<init>(InitialLdapContext.java:154)
at org.springframework.ldap.core.support.LdapContextSource.getDirContextInstance(LdapContextSource.java:42)
at org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:343)
解决方案
推荐阅读
- java - 我想将 product1 的 Elastic search 2.3.5 中的数据保存到 ProductV2 的 Elastic search 6.2
- html - 带有没有目标属性的链接的 CSS 选择器
- sql - 在oracle中从同一个表中选择一行两次
- python - GeneratorExit 异常:无说明
- excel - 使用 VBA 遍历 ActiveX 标签
- qt - 如何在 QML 项目中显示本地目录中的多个视频?
- javascript - Javascript从div id添加一个变量
- javascript - 使用 Axios 和 final-form 从 catch 中返回 Promise
- php - PHP 创建一个 ping 脚本需要将响应转换为对象来读取它
- r - 将一个数据帧中的每一行与 tidyverse 中另一个数据帧的每一行进行比较