Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @RequestMapping(value = "token",method = RequestMethod.POST, produces = "text/plain")
- public ResponseEntity<String> authorize(@RequestParam String secret, @RequestParam String accountKey, @RequestParam String login, @RequestParam String appKey){
- String url = "http://a.wykop.pl/user/login/appkey,"+appKey;
- String apisign = AuthComponent.getMD5Hash(secret, url, accountKey, login);
- HttpHeaders headers = new HttpHeaders();
- headers.add("apisign", apisign);
- headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED); //to jest wymagane ewentualnie multipart też przejdzie
- MultiValueMap<String, String> map= new LinkedMultiValueMap<String, String>(); //by móc wysłać urlencoeded, map nie przejdzie
- map.add("accountkey", accountKey);
- map.add("login", login);
- HttpEntity<?> request = new HttpEntity<>(map, headers);
- return restTemplate.postForEntity(url, request, String.class);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement