/**
* Checks if account is active.
* @param userAuth user authentication object
* @param user user object
* @param throwException throw or not
* @return the authentication object if {@code user.active == true}
*/
public static UserAuthentication checkIfActive(UserAuthentication userAuth, User user, boolean throwException) {
if (userAuth == null || user == null || user.getIdentifier() == null) {
if (throwException) {
throw new BadCredentialsException("Bad credentials.");
} else {
logger.error("Bad credentials.");
return null;
}
} else if (!user.getActive()) {
if (throwException) {
throw new LockedException("Account " + user.getId() + " is locked.");
} else {
logger.error("Account {} is locked.", user.getId());
return null;
}
}
return userAuth;
}
SecurityUtils.java 文件源码
java
阅读 39
收藏 0
点赞 0
评论 0
项目:para
作者:
评论列表
文章目录