| | |
| | | private static final String PREFIX = "bearer "; |
| | | @Autowired |
| | | private RemoteController remoteController; |
| | | |
| | | |
| | | public Object getUserInfoFromIam(final String token) { |
| | | final RestTemplate restTemplate = new RestTemplate(); |
| | | final String url = PropertiesUtil.getProperty("userInfo_url"); |
| | |
| | | final ResponseEntity<String> responseEntity = (ResponseEntity<String>)restTemplate.exchange(url, HttpMethod.GET, httpEntity, (Class)String.class, new Object[0]); |
| | | if (responseEntity.getStatusCode().value() == 200) { |
| | | result = (String)responseEntity.getBody(); |
| | | System.out.println(result); |
| | | //System.out.println(result); |
| | | } |
| | | if ("".equals(result)) { |
| | | return null; |
| | |
| | | } |
| | | return resultJson.getJSONObject("data"); |
| | | } |
| | | |
| | | |
| | | public String getTokenByCode(final String code) { |
| | | if (StringUtils.isBlank((CharSequence)code)) { |
| | | return null; |
| | |
| | | final ResponseEntity<String> responseEntity = (ResponseEntity<String>)restTemplate.getForEntity(url, (Class)String.class, new Object[0]); |
| | | if (responseEntity.getStatusCode().value() == 200) { |
| | | result = (String)responseEntity.getBody(); |
| | | System.out.println(result); |
| | | //System.out.println(result); |
| | | } |
| | | if (StringUtils.isBlank((CharSequence)result)) { |
| | | return null; |
| | | } |
| | | final JSONObject resultJson = JSONObject.parseObject(result); |
| | | if (resultJson.containsKey((Object)"error")) { |
| | | System.out.println(resultJson.toJSONString()); |
| | | //System.out.println(resultJson.toJSONString()); |
| | | return null; |
| | | } |
| | | return resultJson.getString("data"); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | |
| | | public String getInfo() { |
| | | System.out.println(PropertiesUtil.getProperty("userInfo_url") + PropertiesUtil.getProperty("token_url")); |
| | | //System.out.println(PropertiesUtil.getProperty("userInfo_url") + PropertiesUtil.getProperty("token_url")); |
| | | return PropertiesUtil.getProperty("userInfo_url") + PropertiesUtil.getProperty("token_url"); |
| | | } |
| | | } |