use of org.springframework.security.oauth2.client.token.grant.implicit.ImplicitAccessTokenProvider in project spring-security-oauth by spring-projects.
the class ImplicitProviderTests method testPostForAutomaticApprovalToken.
@Test
@OAuth2ContextConfiguration(resource = AutoApproveImplicit.class, initialize = false)
public void testPostForAutomaticApprovalToken() throws Exception {
final ImplicitAccessTokenProvider implicitProvider = new ImplicitAccessTokenProvider();
implicitProvider.setInterceptors(Arrays.<ClientHttpRequestInterceptor>asList(new ClientHttpRequestInterceptor() {
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution) throws IOException {
ClientHttpResponse result = execution.execute(request, body);
latestHeaders = result.getHeaders();
return result;
}
}));
context.setAccessTokenProvider(implicitProvider);
context.getAccessTokenRequest().setCookie(cookie);
assertNotNull(context.getAccessToken());
assertTrue("Wrong location header: " + latestHeaders.getLocation().getFragment(), latestHeaders.getLocation().getFragment().contains("scope=read write trust"));
}
Aggregations