use of org.wso2.carbon.identity.discovery.builders.DefaultOIDCProviderRequestBuilder in project identity-inbound-auth-oauth by wso2-extensions.
the class DefaultOIDCProcessor method getResponse.
public OIDProviderConfigResponse getResponse(HttpServletRequest request, String tenantDomain) throws OIDCDiscoveryEndPointException, ServerConfigurationException {
OIDCProviderRequestBuilder requestBuilder = new DefaultOIDCProviderRequestBuilder();
OIDProviderRequest requestObject = requestBuilder.buildRequest(request, tenantDomain);
ProviderConfigBuilder responseBuilder = new ProviderConfigBuilder();
return responseBuilder.buildOIDProviderConfig(requestObject);
}
use of org.wso2.carbon.identity.discovery.builders.DefaultOIDCProviderRequestBuilder in project identity-inbound-auth-oauth by wso2-extensions.
the class EndpointUtilTest method mockPrivilegedCarbonContext.
private void mockPrivilegedCarbonContext() {
mockStatic(PrivilegedCarbonContext.class);
when(PrivilegedCarbonContext.getThreadLocalCarbonContext()).thenReturn(mockedPrivilegedCarbonContext);
when(mockedPrivilegedCarbonContext.getOSGiService(OAuthServerConfiguration.class, null)).thenReturn(mockedOAuthServerConfiguration);
when(mockedPrivilegedCarbonContext.getOSGiService(WebFingerProcessor.class, null)).thenReturn(DefaultWebFingerProcessor.getInstance());
when(mockedPrivilegedCarbonContext.getOSGiService(OIDCProviderRequestBuilder.class, null)).thenReturn(new DefaultOIDCProviderRequestBuilder());
when(mockedPrivilegedCarbonContext.getOSGiService(OIDCProcessor.class, null)).thenReturn(DefaultOIDCProcessor.getInstance());
when(mockedPrivilegedCarbonContext.getOSGiService(OAuth2Service.class, null)).thenReturn(new OAuth2Service());
when(mockedPrivilegedCarbonContext.getOSGiService(OAuth2TokenValidationService.class, null)).thenReturn(new OAuth2TokenValidationService());
}
use of org.wso2.carbon.identity.discovery.builders.DefaultOIDCProviderRequestBuilder in project identity-inbound-auth-oauth by wso2-extensions.
the class DefaultOIDCProviderRequestBuilderTest method testBuildRequest.
@Test(dataProvider = "test1")
public void testBuildRequest(String value, String output) throws Exception {
when(mockHttpServletRequest.getRequestURI()).thenReturn("https://test.com");
DefaultOIDCProviderRequestBuilder defaultOIDCProviderRequestBuilder = new DefaultOIDCProviderRequestBuilder();
OIDProviderRequest oidProviderRequest = defaultOIDCProviderRequestBuilder.buildRequest(mockHttpServletRequest, value);
assertEquals(oidProviderRequest.getUri(), "https://test.com", "Result URI is different from " + "the expected URI");
assertEquals(oidProviderRequest.getTenantDomain(), output, "Error in tenant domain");
}
Aggregations