Browse Source

init

tags/24080901
Lierbao 2 years ago
parent
commit
21de4d76d0
1 changed files with 6 additions and 9 deletions
  1. +6
    -9
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/UsernamePasswordAuthFilter.java

+ 6
- 9
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/password/UsernamePasswordAuthFilter.java View File

@@ -24,6 +24,10 @@ public class UsernamePasswordAuthFilter extends AbstractAuthenticationProcessing


private boolean postOnly = true; private boolean postOnly = true;


private static final String USERNAME_PARAMETER = "username";
private static final String PASSWORD_PARAMETER = "password";


// ~ Constructors // ~ Constructors
// =================================================================================================== // ===================================================================================================


@@ -40,18 +44,11 @@ public class UsernamePasswordAuthFilter extends AbstractAuthenticationProcessing
if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) { if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) {
throw new AuthenticationServiceException("请求方法错误"); throw new AuthenticationServiceException("请求方法错误");
} }
String usernameParameter = "username";
String username = request.getParameter(usernameParameter);
String passwordParameter = "password";
String password = request.getParameter(passwordParameter);
String loginPlatformParameter = "loginPlatform";
String loginPlatform = request.getParameter(loginPlatformParameter);
String username = request.getParameter(USERNAME_PARAMETER);
String password = request.getParameter(PASSWORD_PARAMETER);
if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) { if (StringUtils.isBlank(username) || StringUtils.isBlank(password)) {
throw new UsernameNotFoundException("用户名或密码不能为空"); throw new UsernameNotFoundException("用户名或密码不能为空");
} }
if (StringUtils.isBlank(loginPlatform)) {
throw new BizException("登录平台类型不能为空");
}
username = username.trim(); username = username.trim();
password = password.trim(); password = password.trim();
try { try {


Loading…
Cancel
Save