Преглед изворни кода

临时开发登陆鉴权

master
liuxinxin пре 1 година
родитељ
комит
4ae47f0927
2 измењених фајлова са 42 додато и 24 уклоњено
  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 Прегледај датотеку

@@ -45,18 +45,26 @@ public class UserAuthLoginManage {
* @return
*/
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.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;
}

@@ -67,17 +75,25 @@ public class UserAuthLoginManage {
* @return
*/
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.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;
}
}

+ 8
- 6
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java Прегледај датотеку

@@ -58,12 +58,14 @@ public class CredentialAuthProvider implements AuthenticationProvider {
}
break;
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;
}


Loading…
Откажи
Сачувај