本文整理匯總了Java中org.apache.shiro.authc.AuthenticationException.getMessage方法的典型用法代碼示例。如果您正苦於以下問題:Java AuthenticationException.getMessage方法的具體用法?Java AuthenticationException.getMessage怎麽用?Java AuthenticationException.getMessage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.shiro.authc.AuthenticationException
的用法示例。
在下文中一共展示了AuthenticationException.getMessage方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLoginFailure
import org.apache.shiro.authc.AuthenticationException; //導入方法依賴的package包/類
/**
* 登錄失敗調用事件
*/
@Override
protected boolean onLoginFailure(AuthenticationToken token,
AuthenticationException e, ServletRequest request, ServletResponse response) {
String className = e.getClass().getName(), message = "";
if (IncorrectCredentialsException.class.getName().equals(className)
|| UnknownAccountException.class.getName().equals(className)){
message = "用戶或密碼錯誤, 請重試.";
}
else if (e.getMessage() != null && StringUtils.startsWith(e.getMessage(), "msg:")){
message = StringUtils.replace(e.getMessage(), "msg:", "");
}
else{
message = "係統出現點問題,請稍後再試!";
e.printStackTrace(); // 輸出到控製台
}
request.setAttribute(getFailureKeyAttribute(), className);
request.setAttribute(getMessageParam(), message);
return true;
}
示例2: onLoginFailure
import org.apache.shiro.authc.AuthenticationException; //導入方法依賴的package包/類
/**
* 登錄失敗調用事件
*/
@Override
protected boolean onLoginFailure(AuthenticationToken token, AuthenticationException e, ServletRequest request,
ServletResponse response) {
String className = e.getClass().getName(), message = "";
if (IncorrectCredentialsException.class.getName().equals(className)
|| UnknownAccountException.class.getName().equals(className)) {
message = "用戶或密碼錯誤, 請重試.";
} else if (e.getMessage() != null && StringUtils.startsWith(e.getMessage(), "msg:")) {
message = StringUtils.replace(e.getMessage(), "msg:", "");
} else {
message = "係統出現點問題,請稍後再試!";
e.printStackTrace(); // 輸出到控製台
}
request.setAttribute(getFailureKeyAttribute(), className);
request.setAttribute(getMessageParam(), message);
return true;
}
示例3: onLoginFailure
import org.apache.shiro.authc.AuthenticationException; //導入方法依賴的package包/類
/**
* 登錄失敗調用事件
*/
@Override
protected boolean onLoginFailure(AuthenticationToken token,
AuthenticationException e, ServletRequest request, ServletResponse response) {
String className = e.getClass().getName(), message = "";
if (IncorrectCredentialsException.class.getName().equals(className)
|| UnknownAccountException.class.getName().equals(className)){
message = "用戶或密碼錯誤, 請重試.";
}
else if (e.getMessage() != null && StringUtils.startsWith(e.getMessage(), "msg:")){
message = StringUtils.replace(e.getMessage(), "msg:", "");
}
else{
message = "係統出現點問題,請稍後再試!";
e.printStackTrace(); // 輸出到控製台
}
request.setAttribute(getFailureKeyAttribute(), className);
request.setAttribute(getMessageParam(), message);
return true;
}
示例4: authenticateByEmailAddress
import org.apache.shiro.authc.AuthenticationException; //導入方法依賴的package包/類
@Override
public int authenticateByEmailAddress(
long companyId, String emailAddress, String password,
Map<String, String[]> headerMap, Map<String, String[]> parameterMap)
throws AuthException {
if (_log.isInfoEnabled()) {
_log.info("authenticateByEmailAddress");
}
UsernamePasswordToken usernamePasswordToken = new UsernamePasswordToken(
emailAddress, password);
Subject currentUser = SecurityUtils.getSubject();
try {
currentUser.login(usernamePasswordToken);
boolean authenticated = currentUser.isAuthenticated();
if (authenticated) {
if (_log.isInfoEnabled()) {
_log.info("authenticated");
}
return SKIP_LIFERAY_CHECK;
}
else {
return FAILURE;
}
}
catch (AuthenticationException ae) {
_log.error(ae.getMessage(), ae);
throw new AuthException(ae.getMessage(), ae);
}
}
示例5: setFailureAttribute
import org.apache.shiro.authc.AuthenticationException; //導入方法依賴的package包/類
protected void setFailureAttribute(ServletRequest request, AuthenticationException ae) {
request.setAttribute(getFailureKeyAttribute(), ae.getClass().getName());
if (ae.getMessage() != null && StringUtils.startsWith(ae.getMessage(), "msg:")){
String message = StringUtils.replace(ae.getMessage(), "msg:", "");
request.setAttribute(getMessageParam(), message);
}
}