use of org.springframework.security.oauth2.client.token.DefaultAccessTokenRequest in project spring-security-oauth by spring-projects.
the class AccessTokenProviderChainTests method testSunnyDayWIthExpiredTokenAndValidRefreshToken.
@Test
public void testSunnyDayWIthExpiredTokenAndValidRefreshToken() throws Exception {
AccessTokenProviderChain chain = new AccessTokenProviderChain(Arrays.asList(new StubAccessTokenProvider()));
accessToken.setExpiration(new Date(System.currentTimeMillis() - 1000));
accessToken.setRefreshToken(new DefaultOAuth2RefreshToken("EXP"));
AccessTokenRequest request = new DefaultAccessTokenRequest();
request.setExistingToken(accessToken);
SecurityContextHolder.getContext().setAuthentication(user);
OAuth2AccessToken token = chain.obtainAccessToken(resource, request);
assertNotNull(token);
}
Aggregations