本文整理汇总了Java中org.gluu.persist.exception.operation.AuthenticationException类的典型用法代码示例。如果您正苦于以下问题:Java AuthenticationException类的具体用法?Java AuthenticationException怎么用?Java AuthenticationException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticationException类属于org.gluu.persist.exception.operation包,在下文中一共展示了AuthenticationException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.gluu.persist.exception.operation.AuthenticationException; //导入依赖的package包/类
public String update(boolean verifyPassword) throws Exception {
String result;
boolean verifyOldPass;
try {
verifyOldPass = personService.authenticate(getPerson().getUid(), oldPassword);
} catch (AuthenticationException e) {
verifyOldPass = false;
}
if ((verifyOldPass || !verifyPassword) /*
* && validatePassword().equals(
* Configuration.RESULT_SUCCESS)
*/) {
getPerson().setUserPassword(newPassword);
personService.updatePerson(getPerson());
result = OxTrustConstants.RESULT_SUCCESS;
} else {
result = OxTrustConstants.RESULT_FAILURE;
}
return result;
}
示例2: storeNewPassword
import org.gluu.persist.exception.operation.AuthenticationException; //导入依赖的package包/类
public void storeNewPassword(GluuCustomPerson person, boolean validateOldPassword) {
if (validateOldPassword) {
boolean resultValidateOldPassword = false;
try {
if ((person != null) && StringHelper.isNotEmpty(person.getUid())) {
resultValidateOldPassword = personService.authenticate(person.getUid(), oldPassword);
}
} catch (AuthenticationException ex) {
log.debug("Failed to verify old person password", ex);
}
if (!resultValidateOldPassword) {
if (graphValidator == null) {
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Old password isn't valid!", "Old password isn't valid!"));
} else {
FacesContext.getCurrentInstance().addMessage(graphValidator.getClientId(),
new FacesMessage(FacesMessage.SEVERITY_ERROR, "Old password isn't valid!", "Old password isn't valid!"));
}
}
}
FacesContext.getCurrentInstance().addMessage(null,
new FacesMessage(FacesMessage.SEVERITY_INFO, "Successfully changed!", "Successfully changed!"));
}
示例3: authenticate
import org.gluu.persist.exception.operation.AuthenticationException; //导入依赖的package包/类
@Override
public boolean authenticate(String bindDn, String password) {
try {
return ldapOperationService.authenticate(bindDn, password);
} catch (ConnectionException ex) {
throw new AuthenticationException(String.format("Failed to authenticate DN: %s", bindDn), ex);
}
}
示例4: processAuthenticationFilter
import org.gluu.persist.exception.operation.AuthenticationException; //导入依赖的package包/类
public String processAuthenticationFilter(AuthenticationFilterWithParameters authenticationFilterWithParameters, Map<?, ?> attributeValues) {
if (attributeValues == null) {
return null;
}
final Map<String, String> normalizedAttributeValues = normalizeAttributeMap(attributeValues);
final String resultDn = loadEntryDN(ldapEntryManager, authenticationFilterWithParameters, normalizedAttributeValues);
if (StringUtils.isBlank(resultDn)) {
return null;
}
if (!Boolean.TRUE.equals(authenticationFilterWithParameters.getAuthenticationFilter().getBind())) {
return resultDn;
}
String bindPasswordAttribute = authenticationFilterWithParameters.getAuthenticationFilter().getBindPasswordAttribute();
if (StringHelper.isEmpty(bindPasswordAttribute)) {
log.error("Skipping authentication filter:\n '{}'\n. It should contains not empty bind-password-attribute attribute. ", authenticationFilterWithParameters.getAuthenticationFilter());
return null;
}
bindPasswordAttribute = StringHelper.toLowerCase(bindPasswordAttribute);
try {
boolean authenticated = ldapEntryManager.authenticate(resultDn, normalizedAttributeValues.get(bindPasswordAttribute));
if (authenticated) {
return resultDn;
}
} catch (AuthenticationException ex) {
log.error("Invalid password", ex);
}
return null;
}