我尝试通过 LDAP 授权用户。public Authentication authenticate(Authentication auth) throws AuthenticationException { String username = getUserNameFromAuth(auth); String password = auth.getCredentials().toString(); HelpDescUser userDetails = (HelpDescUser) userDetailsService.loadUserByUsername(username); String email = userDetails.getEmail(); String url = "ldap://" + ldapHost + ":" + port + "/"; ActiveDirectoryLdapAuthenticationProvider ldapProvider = new ActiveDirectoryLdapAuthenticationProvider(null, url, rootDn); ldapProvider.setSearchFilter(filter); Authentication authenticate = ldapProvider.authenticate(new UsernamePasswordAuthenticationToken(email, password)); if (authenticate.isAuthenticated()) { return new UsernamePasswordAuthenticationToken(userDetails, password, userDetails.getAuthorities()); }}我收到这个:引起:javax.naming.ServiceUnavailableException:okmarket.ru:636;套接字在 java.naming/com.sun.jndi.ldap.Connection.readReply(Connection.java:426) 在 java.naming/com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:365) 在 java 关闭.naming/com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:214) 在 java.naming/com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2795) 在 java.naming/com .sun.jndi.ldap.LdapCtx.(LdapCtx.java:320) 在 java.naming/com.sun.jndi.ldap.LdapCtxFactory.getUsingURL(LdapCtxFactory.java:192) 在 java.naming/com.sun.jndi。 ldap.LdapCtxFactory.getUsingURLs(LdapCtxFactory.java:210) 在 java.naming/com.sun.jndi.ldap.LdapCtxFactory.getLdapCtxInstance(LdapCtxFactory.java:153) 在 java.naming/com.sun.jndi.ldap.LdapCtxFactory。 java 中的 getInitialContext(LdapCtxFactory.java:83)。怎么了?是我这边的问题,还是 LDAP 那边的问题?
添加回答
举报
0/150
提交
取消