Search in sources :

Example 6 with RequestPathAuthenticatorConfig

use of org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig in project product-is by wso2.

the class RequestPathBasicAuthenticationSSOTest method testInit.

@BeforeClass(alwaysRun = true)
public void testInit() throws Exception {
    super.init();
    logManger = new AuthenticatorClient(backendURL);
    adminUsername = userInfo.getUserName();
    adminPassword = userInfo.getPassword();
    logManger.login(isServer.getSuperTenant().getTenantAdmin().getUserName(), isServer.getSuperTenant().getTenantAdmin().getPassword(), isServer.getInstance().getHosts().get("default"));
    appMgtclient = new ApplicationManagementServiceClient(sessionCookie, backendURL, null);
    ssoConfigServiceClient = new SAMLSSOConfigServiceClient(backendURL, sessionCookie);
    client = HttpClientBuilder.create().build();
    isURL = backendURL.substring(0, backendURL.indexOf("services/"));
    ssoConfigServiceClient.addServiceProvider(createSAMLServiceProviderDTO(ISSUER_TRAVELOCITY_COM));
    ssoConfigServiceClient.addServiceProvider(createSAMLServiceProviderDTO(ISSUER_AVIS_COM));
    serviceProviderTravelocity = new ServiceProvider();
    serviceProviderTravelocity.setApplicationName(SERVICE_PROVIDER_NAME_TRAVELOCITY);
    serviceProviderTravelocity.setDescription(SERVICE_PROVIDER_DESC);
    appMgtclient.createApplication(serviceProviderTravelocity);
    serviceProviderTravelocity = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_TRAVELOCITY);
    InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
    InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
    requestConfig.setInboundAuthKey(ISSUER_TRAVELOCITY_COM);
    requestConfig.setInboundAuthType("samlsso");
    Property attributeConsumerServiceIndexProp = new Property();
    attributeConsumerServiceIndexProp.setName("attrConsumServiceIndex");
    attributeConsumerServiceIndexProp.setValue("1239245949");
    requestConfig.setProperties(new Property[] { attributeConsumerServiceIndexProp });
    inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
    serviceProviderTravelocity.setInboundAuthenticationConfig(inboundAuthenticationConfig);
    RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
    requestPathAuthenticatorConfig.setName("BasicAuthRequestPathAuthenticator");
    serviceProviderTravelocity.setRequestPathAuthenticatorConfigs(new RequestPathAuthenticatorConfig[] { requestPathAuthenticatorConfig });
    appMgtclient.updateApplicationData(serviceProviderTravelocity);
    serviceProviderTravelocity = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_TRAVELOCITY);
    serviceProviderAvis = new ServiceProvider();
    serviceProviderAvis.setApplicationName(SERVICE_PROVIDER_NAME_AVIS);
    serviceProviderAvis.setDescription(SERVICE_PROVIDER_DESC);
    appMgtclient.createApplication(serviceProviderAvis);
    serviceProviderAvis = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_AVIS);
    inboundAuthenticationConfig = new InboundAuthenticationConfig();
    requestConfig = new InboundAuthenticationRequestConfig();
    requestConfig.setInboundAuthKey(ISSUER_AVIS_COM);
    requestConfig.setInboundAuthType("samlsso");
    attributeConsumerServiceIndexProp = new Property();
    attributeConsumerServiceIndexProp.setName("attrConsumServiceIndex");
    attributeConsumerServiceIndexProp.setValue("1239245949");
    requestConfig.setProperties(new Property[] { attributeConsumerServiceIndexProp });
    inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
    serviceProviderAvis.setInboundAuthenticationConfig(inboundAuthenticationConfig);
    appMgtclient.updateApplicationData(serviceProviderAvis);
    serviceProviderAvis = appMgtclient.getApplication(SERVICE_PROVIDER_NAME_AVIS);
}
Also used : AuthenticatorClient(org.wso2.carbon.integration.common.admin.client.AuthenticatorClient) InboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ApplicationManagementServiceClient(org.wso2.identity.integration.common.clients.application.mgt.ApplicationManagementServiceClient) SAMLSSOConfigServiceClient(org.wso2.identity.integration.common.clients.sso.saml.SAMLSSOConfigServiceClient) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) RequestPathAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig) Property(org.wso2.carbon.identity.application.common.model.xsd.Property) BeforeClass(org.testng.annotations.BeforeClass)

Example 7 with RequestPathAuthenticatorConfig

use of org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig in project product-is by wso2.

the class UserSessionTest method createServiceProvider.

private ServiceProvider createServiceProvider(String issuer, String serviceProviderName) throws Exception {
    ssoConfigServiceClient.addServiceProvider(createSAMLServiceProviderDTO(issuer));
    ServiceProvider serviceProvider = new ServiceProvider();
    serviceProvider.setApplicationName(serviceProviderName);
    serviceProvider.setDescription(SERVICE_PROVIDER_DESC);
    appMgtclient.createApplication(serviceProvider);
    serviceProvider = appMgtclient.getApplication(serviceProviderName);
    InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
    requestConfig.setInboundAuthKey(issuer);
    requestConfig.setInboundAuthType(SAMLSSO);
    Property attributeConsumerServiceIndexProp = new Property();
    attributeConsumerServiceIndexProp.setName("attrConsumServiceIndex");
    attributeConsumerServiceIndexProp.setValue("1239245949");
    requestConfig.setProperties(new Property[] { attributeConsumerServiceIndexProp });
    InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
    inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
    serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
    RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
    requestPathAuthenticatorConfig.setName(BASIC_AUTH_REQUEST_PATH_AUTHENTICATOR);
    serviceProvider.setRequestPathAuthenticatorConfigs(new RequestPathAuthenticatorConfig[] { requestPathAuthenticatorConfig });
    appMgtclient.updateApplicationData(serviceProvider);
    return appMgtclient.getApplication(serviceProviderName);
}
Also used : InboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) RequestPathAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig) Property(org.wso2.carbon.identity.application.common.model.xsd.Property)

Example 8 with RequestPathAuthenticatorConfig

use of org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig in project product-is by wso2.

the class AbstractSAMLSSOTestCase method createApplication.

public ServiceProvider createApplication(ServiceProvider serviceProvider, SAMLConfig config, String appName) throws Exception {
    serviceProvider.setApplicationName(appName);
    serviceProvider.setDescription("This is a test Service Provider");
    applicationManagementServiceClient.createApplication(serviceProvider);
    serviceProvider = applicationManagementServiceClient.getApplication(appName);
    serviceProvider.getClaimConfig().setClaimMappings(getClaimMappings());
    InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
    requestConfig.setInboundAuthType(INBOUND_AUTH_TYPE);
    requestConfig.setInboundAuthKey(config.getApp().getArtifact());
    Property attributeConsumerServiceIndexProp = new Property();
    attributeConsumerServiceIndexProp.setName(ATTRIBUTE_CS_INDEX_NAME);
    attributeConsumerServiceIndexProp.setValue(ATTRIBUTE_CS_INDEX_VALUE);
    requestConfig.setProperties(new Property[] { attributeConsumerServiceIndexProp });
    InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
    inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
    if (config.httpBinding.equals(HttpBinding.HTTP_SOAP)) {
        RequestPathAuthenticatorConfig requestPathAuthenticatorConfig = new RequestPathAuthenticatorConfig();
        requestPathAuthenticatorConfig.setName("BasicAuthRequestPathAuthenticator");
        serviceProvider.setRequestPathAuthenticatorConfigs(new RequestPathAuthenticatorConfig[] { requestPathAuthenticatorConfig });
    }
    if (samlArtResolve) {
        LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = new LocalAndOutboundAuthenticationConfig();
        localAndOutboundAuthenticationConfig.setSkipConsent(true);
        serviceProvider.setLocalAndOutBoundAuthenticationConfig(localAndOutboundAuthenticationConfig);
    }
    serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
    applicationManagementServiceClient.updateApplicationData(serviceProvider);
    return serviceProvider;
}
Also used : LocalAndOutboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig) InboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) RequestPathAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig) Property(org.wso2.carbon.identity.application.common.model.xsd.Property)

Example 9 with RequestPathAuthenticatorConfig

use of org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig in project product-is by wso2.

the class ApplicationManagementTestCase method testUpdateRequestPathAuthenticators.

@Test(alwaysRun = true, description = "2.1.2.8")
public void testUpdateRequestPathAuthenticators() {
    String applicationName = "TestServiceProvider";
    try {
        ServiceProvider serviceProvider = applicationManagementServiceClient.getApplication(applicationName);
        List<RequestPathAuthenticatorConfig> reqAuthList = new ArrayList<RequestPathAuthenticatorConfig>();
        RequestPathAuthenticatorConfig reqAuth = new RequestPathAuthenticatorConfig();
        reqAuth.setName(BASIC_AUTH_REQUEST_PATH_AUTHENTICATOR);
        reqAuth.setDisplayName(BASIC_AUTH_REQUEST_AUTHENTICATOR_DISPLAYNAME);
        reqAuthList.add(reqAuth);
        serviceProvider.setRequestPathAuthenticatorConfigs(reqAuthList.toArray(new RequestPathAuthenticatorConfig[reqAuthList.size()]));
        applicationManagementServiceClient.updateApplicationData(serviceProvider);
        ServiceProvider updatedServiceProvider = applicationManagementServiceClient.getApplication(applicationName);
        Assert.assertEquals(updatedServiceProvider.getRequestPathAuthenticatorConfigs()[0].getName(), BASIC_AUTH_REQUEST_PATH_AUTHENTICATOR, "Failed update Request path authenticator name");
    } catch (Exception e) {
        Assert.fail("Error while trying to update Request Path Authenticators", e);
    }
}
Also used : ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) ArrayList(java.util.ArrayList) RequestPathAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig) Test(org.testng.annotations.Test)

Example 10 with RequestPathAuthenticatorConfig

use of org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig in project identity-api-server by wso2.

the class UpdateAuthenticationSequence method buildRequestPathConfig.

private RequestPathAuthenticatorConfig buildRequestPathConfig(String authenticator) {
    RequestPathAuthenticatorConfig requestPath = new RequestPathAuthenticatorConfig();
    requestPath.setName(authenticator);
    requestPath.setEnabled(true);
    return requestPath;
}
Also used : RequestPathAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig)

Aggregations

RequestPathAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.RequestPathAuthenticatorConfig)16 ArrayList (java.util.ArrayList)8 LocalAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.LocalAuthenticatorConfig)8 RequestPathAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.xsd.RequestPathAuthenticatorConfig)7 IdentityApplicationManagementException (org.wso2.carbon.identity.application.common.IdentityApplicationManagementException)6 InboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig)5 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig)5 Property (org.wso2.carbon.identity.application.common.model.xsd.Property)5 ServiceProvider (org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider)5 FederatedAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig)4 SQLException (java.sql.SQLException)3 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)3 PreparedStatement (java.sql.PreparedStatement)2 BeforeClass (org.testng.annotations.BeforeClass)2 Test (org.testng.annotations.Test)2 NamedPreparedStatement (org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement)2 FederatedApplicationAuthenticator (org.wso2.carbon.identity.application.authentication.framework.FederatedApplicationAuthenticator)2 LocalApplicationAuthenticator (org.wso2.carbon.identity.application.authentication.framework.LocalApplicationAuthenticator)2 RequestPathApplicationAuthenticator (org.wso2.carbon.identity.application.authentication.framework.RequestPathApplicationAuthenticator)2 AuthenticatorConfig (org.wso2.carbon.identity.application.authentication.framework.config.model.AuthenticatorConfig)2