use of org.forgerock.oauth2.core.ResourceOwnerSessionValidator in project OpenAM by OpenRock.
the class AuthorizationServiceImplTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
requestValidator = mock(AuthorizeRequestValidator.class);
List<AuthorizeRequestValidator> requestValidators = new ArrayList<AuthorizeRequestValidator>();
requestValidators.add(requestValidator);
resourceOwnerSessionValidator = mock(ResourceOwnerSessionValidator.class);
OAuth2ProviderSettingsFactory providerSettingsFactory = mock(OAuth2ProviderSettingsFactory.class);
resourceOwnerConsentVerifier = mock(ResourceOwnerConsentVerifier.class);
clientRegistrationStore = mock(ClientRegistrationStore.class);
tokenIssuer = mock(AuthorizationTokenIssuer.class);
ClientAuthenticationFailureFactory failureFactory = mock(ClientAuthenticationFailureFactory.class);
authorizationService = new AuthorizationServiceImpl(requestValidators, resourceOwnerSessionValidator, providerSettingsFactory, resourceOwnerConsentVerifier, clientRegistrationStore, tokenIssuer, failureFactory);
providerSettings = mock(OAuth2ProviderSettings.class);
given(providerSettingsFactory.get(Matchers.<OAuth2Request>anyObject())).willReturn(providerSettings);
}
use of org.forgerock.oauth2.core.ResourceOwnerSessionValidator in project OpenAM by OpenRock.
the class OpenAMResourceOwnerSessionValidatorTest method setUp.
@BeforeMethod
public void setUp() throws Exception {
mockSSOTokenManager = mock(SSOTokenManager.class);
mockProviderSettingsFactory = mock(OAuth2ProviderSettingsFactory.class);
providerSettings = mock(OAuth2ProviderSettings.class);
mockOAuth2Request = mock(OAuth2Request.class);
restletRequest = new Request();
mockHttpServletRequest = mock(HttpServletRequest.class);
CoreGuiceModule.DNWrapper dnWrapper = mock(CoreGuiceModule.DNWrapper.class);
OpenAMClientDAO mockClientDAO = mock(OpenAMClientDAO.class);
ClientCredentialsReader mockClientCredentialsReader = mock(ClientCredentialsReader.class);
given(mockOAuth2Request.getRequest()).willReturn(restletRequest);
given(mockHttpServletRequest.getRequestURI()).willReturn("/openam/oauth2/authorize");
given(mockHttpServletRequest.getScheme()).willReturn("http");
given(mockHttpServletRequest.getServerName()).willReturn("openam.example.com");
given(mockHttpServletRequest.getServerPort()).willReturn(8080);
given(ACTIVE_SESSION_TOKEN.getProperty("Organization")).willReturn("/");
given(mockProviderSettingsFactory.get(any(OAuth2Request.class))).willReturn(providerSettings);
resourceOwnerSessionValidator = new OpenAMResourceOwnerSessionValidator(dnWrapper, mockSSOTokenManager, mockProviderSettingsFactory, mockClientDAO, mockClientCredentialsReader) {
@Override
HttpServletRequest getHttpServletRequest(Request req) {
return mockHttpServletRequest;
}
};
when(dnWrapper.orgNameToDN("/")).thenReturn("/");
}
Aggregations