简体   繁体   中英

LDAP Authentication to AD error code

I have one question, i'm trying to to authenticate to AD via LDAP, and when i put invalid credentials i got exception message like this: LDAPException(resultCode=49 (invalid credentials), errorMessage='80090308: LdapErr: DSID-0C0903A9, comment: AcceptSecurityContext error, data 52e, v1db0 , and this is ok, but more exact reason of this exception is in part"data 52e", and it tell's me "invalid credentials ". When credentials are good but for example "password expired" in exception message i will get "data 532". This part of message can have different values depending of exception reason (533-account disabled, 701-account expired etc.). My problem is how to catch only this part of exception message. I want to handle the exception according to this error code. Fore example :

switch(err_code){
case 52e:
System.out.println("invalid credentials");
break;
case "530,":
System.out.println("not permitted to logon at this time");
break;
}

But I don't want to use regular expresions to match error code. Any ideas?

These codes are probably specific to Active Directory implementation. Have a look at the explanation to the similar question .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM