...
 
Commits (2)
    https://gitcode.net/fujieid/jap/-/commit/1617c9593fa3d0c79918e3adc754e9d89fc78188 :sparkles: docs: 2021-10-22T11:14:00+08:00 yadong.zhang yadong.zhang0415@gmail.com https://gitcode.net/fujieid/jap/-/commit/11c794ddf483e9619a6acda69c345cd1cf03591d :zap: change: Optimize the code 2021-10-22T11:14:15+08:00 yadong.zhang yadong.zhang0415@gmail.com
......@@ -39,6 +39,7 @@ public enum JapErrorCode {
MISS_CREDENTIALS(1007, "Missing credentials"),
INVALID_GRANT_TYPE(1008, "The grant type is not supported by the authorization server, or the current client is not authorized for the grant type."),
ERROR_HTTP_API_CONFIG(1008, "http api config error,please check"),
LOGIN_FAILURE(1009, "Incorrect username or password."),
LDAP_NOT_IMPLEMENTED_ENCRYPTION(2001, "LDAP password encryption is not implemented"),
LDAP_NOT_IMPLEMENTED_MATCH(2002, "LDAP password matching method is not implemented"),
LDAP_ILLEGAL_PASSWORD_ENCRYPTION_ALGORITHM(2003, "Illegal password encryption algorithm"),
......
......@@ -8,7 +8,6 @@ docker-compose.yml
```yaml
version: '3.3'
services:
# MySQL
ldap:
image: osixia/openldap
container_name: ldap
......
......@@ -53,9 +53,9 @@ public class LdapDataSource {
protected DirContext initialDirContext(Hashtable<?, ?> environment) {
try {
ctx = new InitialDirContext(environment);
log.info("connect to ldap " + ldapConfig.getUrl() + " successful.");
log.info("connect to ldap [" + ldapConfig.getUrl() + "] successful.");
} catch (NamingException e) {
log.error("connect to ldap " + ldapConfig.getUrl() + " failure.", e);
log.error("connect to ldap [" + ldapConfig.getUrl() + "] failure.", e);
}
return ctx;
}
......
......@@ -78,7 +78,7 @@ public class LdapStrategy extends AbstractJapStrategy {
return JapResponse.error(e.getErrorCode(), e.getErrorMessage());
}
if (null == ldapPerson) {
return JapResponse.error(JapErrorCode.INVALID_PASSWORD);
return JapResponse.error(JapErrorCode.LOGIN_FAILURE);
}
JapUser japUser = this.japUserService.createAndGetLdapUser(ldapPerson);
if (null == japUser) {
......