本文整理匯總了Java中org.apache.shiro.web.filter.authc.FormAuthenticationFilter.DEFAULT_USERNAME_PARAM屬性的典型用法代碼示例。如果您正苦於以下問題:Java FormAuthenticationFilter.DEFAULT_USERNAME_PARAM屬性的具體用法?Java FormAuthenticationFilter.DEFAULT_USERNAME_PARAM怎麽用?Java FormAuthenticationFilter.DEFAULT_USERNAME_PARAM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類org.apache.shiro.web.filter.authc.FormAuthenticationFilter
的用法示例。
在下文中一共展示了FormAuthenticationFilter.DEFAULT_USERNAME_PARAM屬性的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: index
@RequestMapping(value = ACTION_INDEX, method = RequestMethod.POST)
public String index(
@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String username,
Map<String, Object> map, HttpServletRequest request,
HttpServletResponse response) {
defaultLocale = request.getLocale();
Shiro shiro = Shiro.get();
if (null != shiro && null != username
&& shiro.getEmail().equals(username)) {
return REDIRECT + VIEW_WIDGET + VIEW_KETTLE + VIEW_REPOS
+ ACTION_LIST;
}
String message = exception(request);
map.put("message", message);
map.put("username", username);
return PAGE_INDEX;
}
示例2: fail
@RequestMapping(value = "/user/login", method = RequestMethod.POST)
public String fail(
@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName,
HttpServletRequest request, Model model) {
// 用戶名
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM,
userName);
// 登錄失敗異常
model.addAttribute(
FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME,
request.getAttribute(FormAuthenticationFilter.DEFAULT_ERROR_KEY_ATTRIBUTE_NAME));
return "login";
}
示例3: fail
/**
* @Title: fail
* @Description: TODO(該方法調用前會被Filter攔截,交給shiro驗證,如果驗證失敗會調用該方法)
* @param @param userName
* @param @param model
* @param @return 設定文件
* @return String 返回類型
* @throws
*/
@RequestMapping(value = "/login.htm", method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM)
String username,String password, Model model,Member member,HttpServletRequest request) {
if (null != SecurityUtils.getSubject() && null != SecurityUtils.getSubject().getSession()) {
SecurityUtils.getSubject().logout();// 進入登錄頁麵,默認把登錄用戶注銷
}
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, username);
member.setMemberName(username);
member.setMemberPassword(password);
request.setAttribute("member", member);
return "login";
}
示例4: fail
/**
* @Title: fail
* @Description: TODO(該方法調用前會被Filter攔截,交給shiro驗證,如果驗證失敗會調用該方法)
* @param @param userName
* @param @param model
* @param @return 設定文件
* @return String 返回類型
* @throws
*/
@RequestMapping(value = "/login.htm", method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM)
String userName, Model model) {
if (null != SecurityUtils.getSubject() && null != SecurityUtils.getSubject().getSession()) {
SecurityUtils.getSubject().logout();// 進入登錄頁麵,默認把登錄用戶注銷
}
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
return "login";
}
示例5: fail
@RequestMapping(method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName, Model model) {
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
return "account/login";
}
示例6: fail
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName, Model model) {
System.out.println("fail again..");
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
return "account/login";
}
示例7: fail
/**
* 登陸驗證失敗跳轉
*
* @param userName
* @param model
* @return
*/
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM)
String userName, HttpServletRequest req, Model model) {
String exceptionClassName = (String) req.getAttribute("shiroLoginFailure");
String error = null;
if (UnknownAccountException.class.getName().equals(exceptionClassName)) {
error = "您還沒有注冊,請注冊使用!";
} else if (IncorrectCredentialsException.class.getName().equals(exceptionClassName)) {
error = "用戶名/密碼不正確!";
} else if (CaptchaInvalidException.class.getName().equals(exceptionClassName)) {
error = "圖形驗證碼已經失效,請重新刷新頁麵!";
} else if (CaptchaException.class.getName().equals(exceptionClassName)) {
error = "圖形驗證碼錯誤!";
} else if (AccountException.class.getName().equals(exceptionClassName)) {
error = "用戶名/密碼輸入出錯!";
} else if (exceptionClassName != null) {
error = "登錄失敗,請重試!";
}
if (StringUtils.isEmpty(exceptionClassName)) {
String code = request.getParameter("captcha");
String phone = request.getParameter("username");
String pwd = request.getParameter("password");
if (StringUtils.equalsIgnoreCase(code, (String) session.getAttribute(ValidateCodeServlet.VALIDATE_CODE))) {
updateShiroUser(phone, pwd);
return "redirect:/user/setting";
} else {
error = "圖形驗證碼錯誤!";
}
}
model.addAttribute("errMsg", error);
// ajax未登入情況
if (InvokeTypeTools.isAjax(req)) {
response.setContentType("application/json");
PrintWriter writer = null;
try {
writer = response.getWriter();
} catch (IOException e1) {
e1.printStackTrace();
}
writer.print(JsonResultUtils.createJsonResult(ResultCode.ERROR, "", error));
writer.flush();
writer.close();
}
return "account/login";
}
示例8: fail
@RequestMapping(value = "/login", method = RequestMethod.POST)
public String fail(@RequestParam(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM) String userName, Model model) {
model.addAttribute(FormAuthenticationFilter.DEFAULT_USERNAME_PARAM, userName);
return "login";
}