我正在尝试从java (8u241)连接到AD (2012 R2),但收到此错误
javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903C8, comment: AcceptSecurityContext error, data 5, v2580 ]错误是49,这意味着错误的用户/通过。但这也可能意味着登录被阻止了。我是通过一款名为ADExplorer的应用(来自微软的sysinternals.com ):My Issue On ServerFault - Login blocked for using the ip instead of the name发现的。当主机是ip而不是域名时,Active-Directory将使用错误的user/pass进行回复。
子错误代码是5。我在任何地方都没有找到任何关于此代码5的文档。(不是52e。当我输入错误的用户名时,我得到52e )
这个错误是什么(LDAP错误49,数据5),我如何修复它?
我的代码:
public void authenticate(String username, String password) throws Exception {
@SuppressWarnings("UseOfObsoleteCollectionType")
java.util.Hashtable<Object, Object> env = new java.util.Hashtable<>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
String url = "LDAP://" + serverName.toUpperCase()+ '.' + domainName.toUpperCase();
System.out.println("url = '" + url + "'");
env.put(Context.PROVIDER_URL, url);
String sp = takeUntil(domainName.toUpperCase(), '.') + "\\" + username;
System.out.println("sp = '" + sp + "'");
env.put(Context.SECURITY_AUTHENTICATION, "simple");
env.put(Context.SECURITY_PRINCIPAL, sp);
env.put(Context.SECURITY_CREDENTIALS, password.getBytes(StandardCharsets.UTF_8));
DirContext ctx = new InitialDirContext(env); // javax.naming.AuthenticationException here
ctx.close();
}结果(在服务器上执行- Win Server2012 R2):
C:\Users\Administrator\Desktop>java -jar ActiveDirectory.jar array.is blackhole ARRAY\muaaz P0987654321q
url = 'LDAP://BLACKHOLE.ARRAY.IS'
sp = 'ARRAY\muaaz'
javax.naming.AuthenticationException: [LDAP: error code 49 - 80090308: LdapErr: DSID-0C0903C8, comment: AcceptSecurityContext error, data 5, v2580 ]发布于 2020-05-10 16:48:14
我删除了操作系统并安装了另一个版本,从而解决了这个问题。
发布于 2020-04-12 00:53:28
"data“后面的数字是Windows系统错误代码,您可以在Microsoft文档中找到。这个特别的词在the first page上,意思是“访问被拒绝”。
这更多的是一个授权错误,而不是身份验证。意思是“我知道你是谁,你不能这么做。”
我不知道在什么情况下会导致这个错误。也许简单绑定在你的域上被禁用了。也许你使用的账号有某种限制。我不能肯定。
https://stackoverflow.com/questions/61155640
复制相似问题