PasswordCredentialsGrantTypeHandlerTest.java revision 3e00d049c722abe4b6819929a7bfef6c3f62d4f2
/*
* 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 ForgeRock AS.
*/
/**
* @since 12.0.0
*/
public class PasswordCredentialsGrantTypeHandlerTest {
private ClientAuthenticator clientAuthenticator;
private OAuth2ProviderSettings providerSettings;
private TokenStore tokenStore;
public void setUp() {
= new ArrayList<PasswordCredentialsRequestValidator>();
given(providerSettingsFactory.get(Matchers.<OAuth2Request>anyObject())).willReturn(providerSettings);
}
@Test
public void shouldHandle() throws Exception {
//Given
given(tokenStore.createAccessToken(anyString(), anyString(), anyString(), anyString(), anyString(), anyString(),
//When
//Then
}
public void handleShouldThrowInvalidGrantExceptionWhenResourceOwnerCannotBeVerified() throws Exception {
//Given
//When
//Then
// Expect InvalidGrantException
}
@Test
public void shouldHandleAndIssueRefreshToken() throws Exception {
//Given
given(tokenStore.createRefreshToken(anyString(), anyString(), anyString(), anyString(), anySetOf(String.class),
given(tokenStore.createAccessToken(anyString(), anyString(), anyString(), anyString(), anyString(), anyString(),
//When
//Then
}
@Test
public void shouldHandleAndIncludeScopeInAccessToken() throws Exception {
//Given
given(tokenStore.createAccessToken(anyString(), anyString(), anyString(), anyString(), anyString(), anyString(),
//When
//Then
}
}