Browse Source

临时开发登陆鉴权

master
liuxinxin 1 year ago
parent
commit
4ae47f0927
2 changed files with 42 additions and 24 deletions
  1. +34
    -18
      pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java
  2. +8
    -6
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java

+ 34
- 18
pmapi/src/main/java/com/ningdatech/pmapi/user/manage/UserAuthLoginManage.java View File

@@ -45,18 +45,26 @@ public class UserAuthLoginManage {
* @return * @return
*/ */
public UserFullInfoDTO queryUserInfoInPhoneNoAuth(String phoneNo) { public UserFullInfoDTO queryUserInfoInPhoneNoAuth(String phoneNo) {
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getMobile, phoneNo));
if (Objects.isNull(userInfo)) {
return null;
}
// UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
// .eq(UserInfo::getMobile, phoneNo));
// if (Objects.isNull(userInfo)) {
// return null;
// }
//
// UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
// userFullInfoDTO.setCompanyId(1L);
// userFullInfoDTO.setUserId(userInfo.getId());
// userFullInfoDTO.setIdentifier(userInfo.getRealName());
// userFullInfoDTO.setRealName(userInfo.getRealName());
// userFullInfoDTO.setUsername(userInfo.getRealName());
// return userFullInfoDTO;


UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO(); UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
userFullInfoDTO.setCompanyId(1L); userFullInfoDTO.setCompanyId(1L);
userFullInfoDTO.setUserId(userInfo.getId());
userFullInfoDTO.setIdentifier(userInfo.getRealName());
userFullInfoDTO.setRealName(userInfo.getRealName());
userFullInfoDTO.setUsername(userInfo.getRealName());
userFullInfoDTO.setUserId(1L);
userFullInfoDTO.setIdentifier("123456");
userFullInfoDTO.setRealName("测试账号");
userFullInfoDTO.setUsername("测试账号");
return userFullInfoDTO; return userFullInfoDTO;
} }


@@ -67,17 +75,25 @@ public class UserAuthLoginManage {
* @return * @return
*/ */
public UserFullInfoDTO queryUserInfoInAccountIdAuth(String accountId) { public UserFullInfoDTO queryUserInfoInAccountIdAuth(String accountId) {
UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
.eq(UserInfo::getAccountId, accountId));
if (Objects.isNull(userInfo)) {
return null;
}
// UserInfo userInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class)
// .eq(UserInfo::getAccountId, accountId));
// if (Objects.isNull(userInfo)) {
// return null;
// }
// UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
// userFullInfoDTO.setCompanyId(1L);
// userFullInfoDTO.setUserId(userInfo.getId());
// userFullInfoDTO.setIdentifier(userInfo.getRealName());
// userFullInfoDTO.setRealName(userInfo.getRealName());
// userFullInfoDTO.setUsername(userInfo.getRealName());
// return userFullInfoDTO;

UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO(); UserFullInfoDTO userFullInfoDTO = new UserFullInfoDTO();
userFullInfoDTO.setCompanyId(1L); userFullInfoDTO.setCompanyId(1L);
userFullInfoDTO.setUserId(userInfo.getId());
userFullInfoDTO.setIdentifier(userInfo.getRealName());
userFullInfoDTO.setRealName(userInfo.getRealName());
userFullInfoDTO.setUsername(userInfo.getRealName());
userFullInfoDTO.setUserId(1L);
userFullInfoDTO.setIdentifier("123456");
userFullInfoDTO.setRealName("测试账号");
userFullInfoDTO.setUsername("测试账号");
return userFullInfoDTO; return userFullInfoDTO;
} }
} }

+ 8
- 6
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java View File

@@ -58,12 +58,14 @@ public class CredentialAuthProvider implements AuthenticationProvider {
} }
break; break;
case USERNAME_PASSWORD_LOGIN: { case USERNAME_PASSWORD_LOGIN: {
user = userDetailsService.loadUserByUsername((String) authenticationToken.getPrincipal());
if (user == null) {
throw new InternalAuthenticationServiceException("can not get user info!");
}
// 账号密码登陆 更改
additionalAuthenticationChecks(user, authenticationToken);
user = userDetailsService.loadUserByUsername(principal + UserDeatilsServiceConstant.USER_DETAILS_SERVICE_SEPARATOR + loginTypeEnum.name());
// TODO 校验测试环境关闭登陆校验

// if (user == null) {
// throw new InternalAuthenticationServiceException("can not get user info!");
// }
// // 账号密码登陆 更改
// additionalAuthenticationChecks(user, authenticationToken);
} }
break; break;
} }


Loading…
Cancel
Save