Posts

Showing posts from May, 2020

oauth/token request manual

ResponseEntity<String> response = null; RestTemplate restTemplate = new RestTemplate(); String credentials = "clientId:clientSecret"; String encodedCredentials = new String(Base64.encodeBase64(credentials.getBytes())); //        System.out.println(username); HttpHeaders headers = new HttpHeaders(); headers.setAccept(Collections.singletonList(MediaType.APPLICATION_JSON)); headers.add("Authorization", "Basic " + encodedCredentials); HttpEntity<String> request = new HttpEntity<String>(headers); String accessTokenUrl = "http://localhost:8080/api/oauth/token" + "?grant_type=password" +         "&username=username" +         "&password=password" +         "&scope=read write"; response = restTemplate.exchange(accessTokenUrl, HttpMethod.POST, request, String.class); //        System.out.println(response.getBody().split(",")[0].spl

oauth_access_token table

create table oauth_access_token ( token_id VARCHAR(255), token BLOB, authentication_id VARCHAR(255), user_name VARCHAR(255), client_id VARCHAR(255), authentication BLOB, refresh_token VARCHAR(255) ); create table oauth_refresh_token ( token_id VARCHAR(255), token BLOB, authentication BLOB );