Created
October 14, 2014 13:33
-
-
Save dploeger/f28275ce20f2e8c8922a to your computer and use it in GitHub Desktop.
Calling Zimbra internal auth from a custom auth extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String encodedPassword = acct.getAttr(Provisioning.A_userPassword); | |
if (acct instanceof LdapEntry) { | |
LdapProvisioning prov = (LdapProvisioning) acct.getProvisioning(); | |
prov.zimbraLdapAuthenticate(acct, password, context); | |
return; // good password, RETURN | |
} else if (PasswordUtil.SSHA.isSSHA(encodedPassword)) { | |
if (PasswordUtil.SSHA.verifySSHA(encodedPassword, password)) { | |
return; // good password, RETURN | |
} else { | |
throw AccountServiceException.AuthFailedServiceException | |
.AUTH_FAILED(acct.getName(), | |
namePassedIn(context), "invalid password"); | |
} | |
} | |
throw AccountServiceException.AuthFailedServiceException.AUTH_FAILED | |
(acct.getName(), namePassedIn(context)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment