Browse Source

init

master
Lierbao 1 year 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 static final String USERNAME_PARAMETER = "username";
private static final String PASSWORD_PARAMETER = "password";


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

@@ -40,18 +44,11 @@ public class UsernamePasswordAuthFilter extends AbstractAuthenticationProcessing
if (postOnly && !request.getMethod().equals(HttpMethod.POST.name())) {
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)) {
throw new UsernameNotFoundException("用户名或密码不能为空");
}
if (StringUtils.isBlank(loginPlatform)) {
throw new BizException("登录平台类型不能为空");
}
username = username.trim();
password = password.trim();
try {


Loading…
Cancel
Save