Sfoglia il codice sorgente

修改健全配置文件

master
liuxinxin 1 anno fa
parent
commit
037afa3d1c
7 ha cambiato i file con 19 aggiunte e 60 eliminazioni
  1. +4
    -4
      pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java
  2. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java
  3. +0
    -42
      pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/PhoneNoLoginUserDetailService.java
  4. +1
    -1
      pmapi/src/main/resources/integration/zwdd-dev.yml
  5. +11
    -10
      pmapi/src/main/resources/integration/zwdd-prod.yml
  6. +1
    -1
      pmapi/src/main/resources/security/auth-dev.yml
  7. +1
    -1
      pmapi/src/main/resources/security/auth-prod.yml

+ 4
- 4
pmapi/src/main/java/com/ningdatech/pmapi/user/controller/UserAuthController.java Vedi File

@@ -37,14 +37,14 @@ public class UserAuthController {
private final ObjectMapper objectMapper;

@PostMapping(value = "/login", consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
@ApiOperation(value = "账号密码的登陆方式")
@ApiOperation(value = "登陆")
@ApiImplicitParams({
@ApiImplicitParam(name = "identifier", value = "用户名", required = true, paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "identifier", value = "账号", required = true, paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "credential", value = "凭证", required = true, paramType = "form", dataType = "String"),
@ApiImplicitParam(name = "loginType", value = "DING_QR_LOGIN 浙政钉扫码登陆,PHONE_VERIFICATION_CODE_LOGIN 手机号验证码登陆"
, required = true, paramType = "form", dataType = "String")})
public void loginByUsernameAndPassword(@RequestParam("username") String username,
@RequestParam("credential") String credential,
public void loginByUsernameAndPassword(@RequestParam(value = "identifier",required = false) String identifier,
@RequestParam(value = "credential",required = false) String credential,
@RequestParam("loginType") String loginType) {
// 不实现任何内容,只是为了出api文档
}


+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/CredentialAuthProvider.java Vedi File

@@ -40,7 +40,7 @@ public class CredentialAuthProvider implements AuthenticationProvider {
case DING_QR_LOGIN: {
String code = (String) authenticationToken.getCredentials();
GenericResult<String> accountResult = zwddAuthClient.getAccountId(code);
if (accountResult.isSuccess()) {
if (!accountResult.isSuccess()) {
throw new BadCredentialsException("login fail! 浙政钉校验失败");
}
String accountId = accountResult.getData();


+ 0
- 42
pmapi/src/main/java/com/ningdatech/pmapi/user/security/auth/credential/PhoneNoLoginUserDetailService.java Vedi File

@@ -1,42 +0,0 @@
package com.ningdatech.pmapi.user.security.auth.credential;


import com.ningdatech.pmapi.user.manage.UserAuthLoginManage;
import com.ningdatech.pmapi.user.security.auth.model.UserFullInfoDTO;
import com.ningdatech.pmapi.user.security.auth.model.UserInfoDetails;
import lombok.RequiredArgsConstructor;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
* @author LiuXinXin
* @date 2022/9/30 上午9:49
*/

@Service("phoneNoLoginUserDetailService")
@RequiredArgsConstructor
public class PhoneNoLoginUserDetailService implements UserDetailsService {

private final UserAuthLoginManage userAuthLoginManage;

@Override
public UserInfoDetails loadUserByUsername(String username) throws UsernameNotFoundException {
UserFullInfoDTO userFullInfoDTO = userAuthLoginManage.queryUserInfoInPhoneNoAuth(username);
if (Objects.isNull(userFullInfoDTO)) {
throw new UsernameNotFoundException(String.format("%s user not exist", username));
}
UserInfoDetails userInfoDetails = new UserInfoDetails();
userInfoDetails.setUserId(userFullInfoDTO.getUserId());
userInfoDetails.setUsername(userFullInfoDTO.getUsername());
userInfoDetails.setRealName(userFullInfoDTO.getRealName());
userInfoDetails.setRole(userFullInfoDTO.getRole());
userInfoDetails.setRegionCode(userFullInfoDTO.getRegionCode());
userInfoDetails.setCompanyId(userFullInfoDTO.getCompanyId());
userInfoDetails.setIdentifier(userFullInfoDTO.getIdentifier());
userInfoDetails.setPassword(userFullInfoDTO.getCredential());
return userInfoDetails;
}
}

+ 1
- 1
pmapi/src/main/resources/integration/zwdd-dev.yml Vedi File

@@ -1,6 +1,6 @@
#专有钉钉
integration:
zzd:
zwdd:
#扫码
app-auth-key: ls-rebuild_dingoa-rgeWs3YVr26z
app-auth-secret: 37qCe6ylNMW0N8K2741z0c2b9vJP2gtuMRQQtZ9P


+ 11
- 10
pmapi/src/main/resources/integration/zwdd-prod.yml Vedi File

@@ -1,11 +1,12 @@
#专有钉钉
ding:
#扫码
app-auth-key: expert-base_dingoa-c5nnefYVnie
app-auth-secret: nm8qtST8uK431HYrjr7srcE23sT4889QgMcYFM3L
# #免登/获取信息
app-key: file-manage-4Mjx9358wuxjyYFjY3
app-secret: hE41938wqyQ5LOpc1QDRA9e7gb5YugoClWD3nY4O
#专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729
tenantId: 31141
domain: openplatform.dg-work.cn
integration:
zwdd:
#扫码
app-auth-key: ls-rebuild_dingoa-rgeWs3YVr26z
app-auth-secret: 37qCe6ylNMW0N8K2741z0c2b9vJP2gtuMRQQtZ9P
#免登/获取信息
app-key: ls_rebuild-10c8n5X0707yFV7jURr
app-secret: gN8J3WazyXLMWKDuFmx6C4yaH5lFUY41x8rYLLo6
#专有钉钉在开发管理工作台,右键查看网页源码realmId: '31141',浙政钉固定196729
tenantId: 31141
domain: openplatform.dg-work.cn

+ 1
- 1
pmapi/src/main/resources/security/auth-dev.yml Vedi File

@@ -2,7 +2,7 @@ security:
auth:
auth-require-url: /api/v1/user/auth/auth-require
invalid-session-url: /api/v1/user/auth/invalid-session
password-login-url: /api/v1/user/auth/login/password
password-login-url: /api/v1/user/auth/login
logout-url: /api/v1/user/auth/logout
ignore-auth-urls:
- /v2/api-docs


+ 1
- 1
pmapi/src/main/resources/security/auth-prod.yml Vedi File

@@ -2,7 +2,7 @@ security:
auth:
auth-require-url: /api/v1/user/auth/auth-require
invalid-session-url: /api/v1/user/auth/invalid-session
password-login-url: /api/v1/user/auth/login/password
password-login-url: /api/v1/user/auth/login
logout-url: /api/v1/user/auth/logout
ignore-auth-urls:
- /v2/api-docs


Loading…
Annulla
Salva