Search in sources :

Example 1 with DefaultOIDCProviderRequestBuilder

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);
}
Also used : ProviderConfigBuilder(org.wso2.carbon.identity.discovery.builders.ProviderConfigBuilder) DefaultOIDCProviderRequestBuilder(org.wso2.carbon.identity.discovery.builders.DefaultOIDCProviderRequestBuilder) DefaultOIDCProviderRequestBuilder(org.wso2.carbon.identity.discovery.builders.DefaultOIDCProviderRequestBuilder) OIDCProviderRequestBuilder(org.wso2.carbon.identity.discovery.builders.OIDCProviderRequestBuilder)

Example 2 with DefaultOIDCProviderRequestBuilder

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());
}
Also used : OAuth2Service(org.wso2.carbon.identity.oauth2.OAuth2Service) DefaultOIDCProviderRequestBuilder(org.wso2.carbon.identity.discovery.builders.DefaultOIDCProviderRequestBuilder) OAuth2TokenValidationService(org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService)

Example 3 with DefaultOIDCProviderRequestBuilder

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");
}
Also used : OIDProviderRequest(org.wso2.carbon.identity.discovery.OIDProviderRequest) Test(org.testng.annotations.Test)

Aggregations

DefaultOIDCProviderRequestBuilder (org.wso2.carbon.identity.discovery.builders.DefaultOIDCProviderRequestBuilder)2 Test (org.testng.annotations.Test)1 OIDProviderRequest (org.wso2.carbon.identity.discovery.OIDProviderRequest)1 OIDCProviderRequestBuilder (org.wso2.carbon.identity.discovery.builders.OIDCProviderRequestBuilder)1 ProviderConfigBuilder (org.wso2.carbon.identity.discovery.builders.ProviderConfigBuilder)1 OAuth2Service (org.wso2.carbon.identity.oauth2.OAuth2Service)1 OAuth2TokenValidationService (org.wso2.carbon.identity.oauth2.OAuth2TokenValidationService)1