-
自定义异常类
创建异常类
public class AccountErrorException extends AuthenticationException {
public AccountErrorException(){
super();
}
public AccountErrorException(String msg) {
super(msg);
}
}
2、配置application.properties
#自定义异常 cas.authn.exceptions.exceptions=com.echemi.sso.execption.AccountErrorException
3、配置messages.properties
authenticationFailure.AccountErrorException=The account does not exist.
4.使用异常信息
if ("USER_NOT_EXIST".equals(message)){
throw new AccountErrorException();
}