| Line 15... |
Line 15... |
| 15 |
import com.fasterxml.jackson.core.JsonProcessingException;
|
15 |
import com.fasterxml.jackson.core.JsonProcessingException;
|
| 16 |
import com.fasterxml.jackson.databind.JsonNode;
|
16 |
import com.fasterxml.jackson.databind.JsonNode;
|
| 17 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
17 |
import com.fasterxml.jackson.databind.ObjectMapper;
|
| 18 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
18 |
import com.spice.profitmandi.common.enumuration.SchemeType;
|
| 19 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
19 |
import com.spice.profitmandi.common.exception.ProfitMandiBusinessException;
|
| - |
|
20 |
import com.spice.profitmandi.common.model.GoogleLoginRequest;
|
| 20 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
21 |
import com.spice.profitmandi.common.model.ProfitMandiConstants;
|
| 21 |
import com.spice.profitmandi.common.util.JWTUtil;
|
22 |
import com.spice.profitmandi.common.util.JWTUtil;
|
| 22 |
import com.spice.profitmandi.common.web.client.RestClient;
|
23 |
import com.spice.profitmandi.common.web.client.RestClient;
|
| 23 |
import com.spice.profitmandi.dao.entity.dtr.SocialUser;
|
24 |
import com.spice.profitmandi.dao.entity.dtr.SocialUser;
|
| 24 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
25 |
import com.spice.profitmandi.dao.entity.dtr.User;
|
| Line 39... |
Line 40... |
| 39 |
private static final String V3_URI = "/oauth2/v3/tokeninfo";
|
40 |
private static final String V3_URI = "/oauth2/v3/tokeninfo";
|
| 40 |
private static final int PORT_NUMBER = 443;
|
41 |
private static final int PORT_NUMBER = 443;
|
| 41 |
private final ObjectMapper objectMapper = new ObjectMapper();
|
42 |
private final ObjectMapper objectMapper = new ObjectMapper();
|
| 42 |
|
43 |
|
| 43 |
@Autowired
|
44 |
@Autowired
|
| 44 |
SocialUserRepository socialUserRepository;
|
45 |
private SocialUserRepository socialUserRepository;
|
| 45 |
|
46 |
|
| 46 |
@Autowired
|
47 |
@Autowired
|
| 47 |
UserRepository userRepository;
|
48 |
private UserRepository userRepository;
|
| 48 |
|
49 |
|
| 49 |
@Autowired
|
50 |
@Autowired
|
| 50 |
UserRoleRepository userRoleRepository;
|
51 |
private UserRoleRepository userRoleRepository;
|
| 51 |
|
52 |
|
| 52 |
public Map<String, Object> process(Map<String, Object> map) throws ProfitMandiBusinessException{
|
53 |
public Map<String, Object> process(GoogleLoginRequest googleLoginRequest) throws ProfitMandiBusinessException{
|
| 53 |
RestClient restClient = new RestClient(SchemeType.HTTPS, V1_HOST_NAME, PORT_NUMBER);
|
54 |
RestClient restClient = new RestClient(SchemeType.HTTPS, V1_HOST_NAME, PORT_NUMBER);
|
| 54 |
Map<String, String> params = new HashMap<>();
|
55 |
Map<String, String> params = new HashMap<>();
|
| 55 |
params.put(ProfitMandiConstants.ACCESS_TOKEN, map.get(ProfitMandiConstants.TOKEN).toString());
|
56 |
params.put(ProfitMandiConstants.ACCESS_TOKEN, googleLoginRequest.getToken());
|
| 56 |
Map<String, String> headers = new HashMap<>(1);
|
57 |
Map<String, String> headers = new HashMap<>(1);
|
| 57 |
headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
58 |
headers.put(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE);
|
| 58 |
String responseString = restClient.get(V1_URI, params, headers);
|
59 |
String responseString = restClient.get(V1_URI, params, headers);
|
| 59 |
try {
|
60 |
try {
|
| 60 |
JsonNode rootNode = objectMapper.readTree(responseString);
|
61 |
JsonNode rootNode = objectMapper.readTree(responseString);
|