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

public void redirect(HttpServletRequest req, HttpServletResponse resp) throws Exception { public void redirect(HttpServletRequest req, HttpServletResponse resp) throws Exception {
//String contNo =req.getParameter("contNo"); //保单号 //String contNo =req.getParameter("contNo"); //保单号
log.info("访问www.baidu.com"); 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

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

private String sub; private String sub;
private List<String> authorityList; private List<String> authorityList;
private List<ClientRoleDto> clientRoleDtoList; private List<ClientRoleDto> clientRoleDtoList;
private ProfileResult profile;
} }

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

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


return JsonResult.success(tokenResult); return JsonResult.success(tokenResult);
} }


tokenResult.setSub(result.getUserName()); tokenResult.setSub(result.getUserName());
tokenResult.setUserId(result.getUserId()); tokenResult.setUserId(result.getUserId());
tokenResult.setUserName(result.getUserName()); 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; return tokenResult;



Loading…
Cancel
Save