use of org.forgerock.oauth2.restlet.RestletOAuth2RequestFactory in project OpenAM by OpenRock.
the class OpenAMTokenStoreTest method setUp.
@BeforeMethod
public void setUp() {
tokenStore = mock(OAuthTokenStore.class);
providerSettingsFactory = mock(OAuth2ProviderSettingsFactory.class);
oAuth2UrisFactory = mock(OAuth2UrisFactory.class);
clientRegistrationStore = mock(OpenIdConnectClientRegistrationStore.class);
realmNormaliser = mock(RealmNormaliser.class);
ssoTokenManager = mock(SSOTokenManager.class);
request = mock(Request.class);
cookieExtractor = mock(CookieExtractor.class);
auditLogger = mock(OAuth2AuditLogger.class);
debug = mock(Debug.class);
failureFactory = mock(ClientAuthenticationFailureFactory.class);
oAuth2RequestFactory = new RestletOAuth2RequestFactory(new JacksonRepresentationFactory(new ObjectMapper()));
ClientAuthenticationFailureFactory failureFactory = mock(ClientAuthenticationFailureFactory.class);
InvalidClientException expectedResult = mock(InvalidClientException.class);
when(expectedResult.getError()).thenReturn(new String("invalid_client"));
when(failureFactory.getException()).thenReturn(expectedResult);
when(failureFactory.getException(anyString())).thenReturn(expectedResult);
when(failureFactory.getException(any(OAuth2Request.class), anyString())).thenReturn(expectedResult);
openAMtokenStore = new OpenAMTokenStore(tokenStore, providerSettingsFactory, oAuth2UrisFactory, clientRegistrationStore, realmNormaliser, ssoTokenManager, cookieExtractor, auditLogger, debug, new SecureRandom(), failureFactory);
}
Aggregations