本文整理汇总了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";
}