提交 11c794dd 编写于 作者: 智布道's avatar 智布道 👁

change: Optimize the code

上级 1617c959
...@@ -39,6 +39,7 @@ public enum JapErrorCode { ...@@ -39,6 +39,7 @@ public enum JapErrorCode {
MISS_CREDENTIALS(1007, "Missing credentials"), 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."), 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"), 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_ENCRYPTION(2001, "LDAP password encryption is not implemented"),
LDAP_NOT_IMPLEMENTED_MATCH(2002, "LDAP password matching method 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"), LDAP_ILLEGAL_PASSWORD_ENCRYPTION_ALGORITHM(2003, "Illegal password encryption algorithm"),
......
...@@ -53,9 +53,9 @@ public class LdapDataSource { ...@@ -53,9 +53,9 @@ public class LdapDataSource {
protected DirContext initialDirContext(Hashtable<?, ?> environment) { protected DirContext initialDirContext(Hashtable<?, ?> environment) {
try { try {
ctx = new InitialDirContext(environment); ctx = new InitialDirContext(environment);
log.info("connect to ldap " + ldapConfig.getUrl() + " successful."); log.info("connect to ldap [" + ldapConfig.getUrl() + "] successful.");
} catch (NamingException e) { } catch (NamingException e) {
log.error("connect to ldap " + ldapConfig.getUrl() + " failure.", e); log.error("connect to ldap [" + ldapConfig.getUrl() + "] failure.", e);
} }
return ctx; return ctx;
} }
......
...@@ -78,7 +78,7 @@ public class LdapStrategy extends AbstractJapStrategy { ...@@ -78,7 +78,7 @@ public class LdapStrategy extends AbstractJapStrategy {
return JapResponse.error(e.getErrorCode(), e.getErrorMessage()); return JapResponse.error(e.getErrorCode(), e.getErrorMessage());
} }
if (null == ldapPerson) { if (null == ldapPerson) {
return JapResponse.error(JapErrorCode.INVALID_PASSWORD); return JapResponse.error(JapErrorCode.LOGIN_FAILURE);
} }
JapUser japUser = this.japUserService.createAndGetLdapUser(ldapPerson); JapUser japUser = this.japUserService.createAndGetLdapUser(ldapPerson);
if (null == japUser) { if (null == japUser) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册