use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-security-oauth by spring-projects.
the class ClientCredentialsProviderTests method testCheckToken.
/**
* tests the check_token endpoint
*/
@Test
@OAuth2ContextConfiguration(ClientCredentials.class)
public void testCheckToken() throws Exception {
OAuth2AccessToken token = context.getAccessToken();
HttpHeaders headers = new HttpHeaders();
headers.set("Content-Type", MediaType.APPLICATION_FORM_URLENCODED_VALUE);
@SuppressWarnings("rawtypes") ResponseEntity<Map> response = new TestRestTemplate("my-client-with-secret", "secret").exchange(http.getUrl(checkTokenPath()), HttpMethod.POST, new HttpEntity<String>("token=" + token.getValue(), headers), Map.class);
assertEquals(HttpStatus.OK, response.getStatusCode());
@SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>) response.getBody();
assertTrue(map.containsKey(AccessTokenConverter.EXP));
assertEquals("my-client-with-secret", map.get(AccessTokenConverter.CLIENT_ID));
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project spring-security-oauth by spring-projects.
the class ClientCredentialsProviderTests method testTokenKey.
@Test
public void testTokenKey() throws Exception {
@SuppressWarnings("rawtypes") ResponseEntity<Map> response = new TestRestTemplate("my-client-with-secret", "secret").getForEntity(http.getUrl(tokenKeyPath()), Map.class);
// This app has no token key.
assertEquals(HttpStatus.FORBIDDEN, response.getStatusCode());
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project java-function-invoker by projectriff.
the class FatJarPlainTests method init.
@Before
public void init() {
runner = new JavaFunctionInvokerApplication();
rest = new TestRestTemplate();
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project java-function-invoker by projectriff.
the class FatJarPofTests method init.
@Before
public void init() {
runner = new JavaFunctionInvokerApplication();
rest = new TestRestTemplate();
}
use of org.springframework.boot.test.web.client.TestRestTemplate in project java-function-invoker by projectriff.
the class IsolatedTests method init.
@Before
public void init() {
runner = new JavaFunctionInvokerApplication();
rest = new TestRestTemplate();
}
Aggregations