AccessTokenServiceImplTest.java revision adc14d0be45af50dbde99eb71c21de3bc1ddb1c6
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2016 ForgeRock AS.
*/
/**
* @since 12.0.0
*/
public class AccessTokenServiceImplTest {
private AccessTokenServiceImpl accessTokenService;
private GrantTypeHandler grantTypeHandler;
private ClientAuthenticator clientAuthenticator;
private TokenStore tokenStore;
private OAuth2ProviderSettings providerSettings;
private OAuth2Uris uris;
given(providerSettingsFactory.get(Matchers.<OAuth2Request>anyObject())).willReturn(providerSettings);
}
@Test
public void shouldRequestAccessToken() throws Exception {
//Given
//When
//Then
}
public void requestAccessTokenShouldThrowInvalidGrantExceptionWhenGrantTypeDoesNotMatchHandler() throws Exception {
//Given
//When
//Then
// Expect InvalidGrantException
}
public void refreshTokenShouldThrowIllegalArgumentExceptionWhenRefreshTokenMissing() throws Exception {
//Given
//When
//Then
// Expect IllegalArgumentException
}
public void refreshTokenShouldThrowIllegalArgumentExceptionWhenRefreshTokenIsEmpty() throws Exception {
//Given
//When
//Then
// Expect IllegalArgumentException
}
public void refreshTokenShouldThrowInvalidRequestExceptionWhenRefreshTokenNotFound() throws Exception {
//Given
//When
//Then
// Expect InvalidRequestException
}
public void refreshTokenShouldThrowInvalidRequestExceptionWhenClientIdsDontMatch() throws Exception {
//Given
//When
//Then
// Expect InvalidRequestException
}
public void refreshTokenShouldThrowInvalidGrantExceptionWhenRefreshTokenHasExpired() throws Exception {
//Given
//When
//Then
// Expect InvalidGrantException
}
@Test
public void shouldRefreshToken() throws Exception {
//Given
//When
//Then
}
@Test
public void shouldRefreshTokenAndIncludeScopeInAccessToken() throws Exception {
//Given
//When
//Then
}
/**
* OPENAM-3997 - ensure that when the setting to generate new refresh tokens is enabled that the new refresh
* token id is returned rather than the old one.
*/
@Test
public void shouldReturnNewRefreshTokenIdWhenRefreshing() throws Exception {
//Given
given(tokenStore.createRefreshToken(anyString(), anyString(), anyString(), anyString(), anySetOf(String.class),
//When
//Then
}
}