Browse Source

更新封装数据

tags/v2.5.2^2
xiaoying 1 year ago
parent
commit
7db1725361
1 changed files with 10 additions and 7 deletions
  1. +10
    -7
      tuoheng_oidc_server/src/main/java/com/tuoheng/service/impl/ThirdServiceImpl.java

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

@@ -3,11 +3,13 @@ package com.tuoheng.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.tuoheng.constants.OidcConstant;
import com.tuoheng.constants.ThirdConstant;
import com.tuoheng.model.dto.ClientRoleDto;
import com.tuoheng.model.result.ProfileResult;
import com.tuoheng.model.result.TokenResult;
import com.tuoheng.service.ThirdService;
import com.tuoheng.until.HttpUtils;
import com.tuoheng.until.JsonResult;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.ParameterizedTypeReference;
@@ -18,6 +20,7 @@ import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;

import java.util.Base64;
import java.util.List;

/**
* @Author xiaoying
@@ -117,17 +120,17 @@ public class ThirdServiceImpl implements ThirdService {

TokenResult result = exchange.getBody().getData();
//封装数据
tokenResult.setAuthorityList(result.getAuthorityList());
tokenResult.setClientRoleDtoList(result.getClientRoleDtoList());
List<String> authorityList = result.getAuthorityList();
List<ClientRoleDto> clientRoleDtoList = result.getClientRoleDtoList();
tokenResult.setAuthorityList(authorityList);
tokenResult.setClientRoleDtoList(clientRoleDtoList);
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());
BeanUtils.copyProperties(tokenResult,profile);
profile.setAuthority(authorityList);
profile.setClientRoleList(clientRoleDtoList);
tokenResult.setProfile(profile);

return tokenResult;

Loading…
Cancel
Save