use of org.apache.directory.ldap.client.template.exception.PasswordException in project directory-ldap-api by apache.
the class AbstractPasswordPolicyResponder method process.
/**
* {@inheritDoc}
*/
@Override
public final PasswordWarning process(PasswordPolicyOperation operation) throws PasswordException {
try {
ResultResponse response = operation.process();
PasswordPolicy passwordPolicy = getPasswordPolicy(response);
ResultCodeEnum resultCode = response.getLdapResult().getResultCode();
if (resultCode == ResultCodeEnum.SUCCESS) {
return success(passwordPolicy);
} else {
throw fail(response, passwordPolicy, resultCode);
}
} catch (LdapException e) {
throw new PasswordException().setLdapException(e);
}
}
use of org.apache.directory.ldap.client.template.exception.PasswordException in project directory-ldap-api by apache.
the class AbstractPasswordPolicyResponder method fail.
/**
* Returns an exception to be thrown in the case of a non SUCCESS
* <code>resultCode</code>.
*
* @param resultResponse The result response
* @param passwordPolicy The password policy in use
* @param resultCode The result
* @return The created PasswordException
*/
protected PasswordException fail(ResultResponse resultResponse, PasswordPolicy passwordPolicy, ResultCodeEnum resultCode) {
PasswordException exception = new PasswordException();
exception.setResultCode(resultCode);
if (passwordPolicy != null && passwordPolicy.getResponse() != null && passwordPolicy.getResponse().getPasswordPolicyError() != null) {
exception.setPasswordPolicyError(passwordPolicy.getResponse().getPasswordPolicyError());
}
return exception;
}
Aggregations