Browse Source

更新相关参数封装校验

tags/v2.5.2^2
xiaoying 1 year ago
parent
commit
064429ca56
4 changed files with 33 additions and 1 deletions
  1. +1
    -1
      tuoheng_oidc_server/src/main/java/com/tuoheng/controller/ThirdController.java
  2. +21
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/result/ProfileResult.java
  3. +1
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/model/result/TokenResult.java
  4. +10
    -0
      tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/ThirdServiceImpl.java

+ 1
- 1
tuoheng_oidc_server/src/main/java/com/tuoheng/controller/ThirdController.java View File

@@ -34,6 +34,6 @@ public class ThirdController {
public void redirect(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//String contNo =req.getParameter("contNo"); //保单号
log.info("访问www.baidu.com");
resp.sendRedirect("http://192.168.12.15:8080/transfer?token123124124");
resp.sendRedirect("http://192.168.12.15:8080/transfer?token=123124124");
}
}

+ 21
- 0
tuoheng_oidc_server/src/main/java/com/tuoheng/model/result/ProfileResult.java View File

@@ -0,0 +1,21 @@
package com.tuoheng.model.result;

import com.tuoheng.model.dto.ClientRoleDto;
import lombok.Data;

import java.util.List;

/**
* @Author xiaoying
* @Date 2023/11/11 13:20
*/
@Data
public class ProfileResult {

private String sub;
private List<String> authority;
private String userId;
private String userName;
private List<ClientRoleDto> clientRoleList;

}

+ 1
- 0
tuoheng_oidc_server/src/main/java/com/tuoheng/model/result/TokenResult.java View File

@@ -22,4 +22,5 @@ public class TokenResult {
private String sub;
private List<String> authorityList;
private List<ClientRoleDto> clientRoleDtoList;
private ProfileResult profile;
}

+ 10
- 0
tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/ThirdServiceImpl.java View File

@@ -3,6 +3,7 @@ package com.tuoheng.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.tuoheng.constants.OidcConstant;
import com.tuoheng.constants.ThirdConstant;
import com.tuoheng.model.result.ProfileResult;
import com.tuoheng.model.result.TokenResult;
import com.tuoheng.service.ThirdService;
import com.tuoheng.until.HttpUtils;
@@ -53,6 +54,8 @@ public class ThirdServiceImpl implements ThirdService {
//此时通过token获取当前用户的相关权限信息并进行封装
tokenResult = getClientResult(tokenResult);
//数据封装完毕返回数据 以及相关地址 -> 是否重定向


return JsonResult.success(tokenResult);
}

@@ -119,6 +122,13 @@ public class ThirdServiceImpl implements ThirdService {
tokenResult.setSub(result.getUserName());
tokenResult.setUserId(result.getUserId());
tokenResult.setUserName(result.getUserName());
ProfileResult profile = tokenResult.getProfile();
profile.setAuthority(result.getAuthorityList());
profile.setClientRoleList(result.getClientRoleDtoList());
profile.setUserId(result.getUserId());
profile.setUserName(result.getUserName());
profile.setSub(result.getUserName());
tokenResult.setProfile(profile);

return tokenResult;


Loading…
Cancel
Save