Я пытаюсь подключиться к тестовому серверу LDAP онлайн, и ниже приведен код, который я пробовал.
Vertx vertx = Vertx.vertx();
JsonObject shiroConfig = new JsonObject().put("ldap_url", "ldap://ldap.forumsys.com:389")
.put("ldap_user_dn_template", "uid={0},ou=mathematicians,dc=example,dc=com");
ShiroAuthOptions shiroAuthOptions = new ShiroAuthOptions().setType(ShiroAuthRealmType.LDAP)
.setConfig(shiroConfig);
AuthProvider authProvider = ShiroAuth.create(vertx, shiroAuthOptions );
JsonObject authInfo = new JsonObject().put("username", "reimann")
.put("password", "password");
System.out.println("before authenticate");
authProvider.authenticate(authInfo, res -> {
if (res.succeeded()) {
System.out.println("Success");
} else {
System.out.println("failure" );
System.out.println(res);
}
});
Ниже приведена ошибка, которую я получаю
before authenticate
failure
Future{cause=LDAP authentication failed.}
Ниже приведено ошибка при печати res.cause (). printStackTrace ():
org.apache.shiro.authc.AuthenticationException: LDAP authentication failed.
at org.apache.shiro.realm.ldap.DefaultLdapRealm.doGetAuthenticationInfo(DefaultLdapRealm.java:300)
at org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:568)
at org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate(AuthenticatingSecurityManager.java:106)
at org.apache.shiro.mgt.DefaultSecurityManager.login(DefaultSecurityManager.java:270)
at org.apache.shiro.subject.support.DelegatingSubject.login(DelegatingSubject.java:256)
at io.vertx.ext.auth.shiro.impl.ShiroAuthProviderImpl.lambda$authenticate$0(ShiroAuthProviderImpl.java:80)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:316)
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.naming.AuthenticationException: [LDAP: error code 49 - Invalid Credentials]
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3135)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:3081)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2883)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2797)
at org.apache.shiro.realm.ldap.JndiLdapContextFactory.getLdapContext(JndiLdapContextFactory.java:495)
at org.apache.shiro.realm.ldap.DefaultLdapRealm.queryForAuthenticationInfo(DefaultLdapRealm.java:375)
at org.apache.shiro.realm.ldap.DefaultLdapRealm.doGetAuthenticationInfo(DefaultLdapRealm.java:295)
... 14 more
В чем может быть проблема?