Search in sources :

Example 16 with LocalAndOutboundAuthenticationConfig

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

the class DefaultAuthSeqManagementTestCase method getDefaultAuthSeq.

private DefaultAuthenticationSequence getDefaultAuthSeq(String seqName, String seqDesc, String seqContentXml, LocalAndOutboundAuthenticationConfig seqContent) {
    DefaultAuthenticationSequence sequence = new DefaultAuthenticationSequence();
    sequence.setName(seqName);
    sequence.setDescription(seqDesc);
    sequence.setContentXml(seqContentXml);
    sequence.setContent(seqContent);
    return sequence;
}
Also used : DefaultAuthenticationSequence(org.wso2.carbon.identity.application.common.model.xsd.DefaultAuthenticationSequence)

Example 17 with LocalAndOutboundAuthenticationConfig

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

the class AbstractAdaptiveAuthenticationTestCase method createServiceProvider.

protected ServiceProvider createServiceProvider(String appName, ApplicationManagementServiceClient applicationManagementServiceClient, OauthAdminClient oauthAdminClient, String script) throws Exception {
    OAuthConsumerAppDTO[] appDtos = oauthAdminClient.getAllOAuthApplicationData();
    for (OAuthConsumerAppDTO appDto : appDtos) {
        if (appDto.getApplicationName().equals(appName)) {
            consumerKey = appDto.getOauthConsumerKey();
            consumerSecret = appDto.getOauthConsumerSecret();
        }
    }
    ServiceProvider serviceProvider = new ServiceProvider();
    serviceProvider.setApplicationName(appName);
    serviceProvider.setDescription("This is a test Service Provider for conditional authentication flow test.");
    applicationManagementServiceClient.createApplication(serviceProvider);
    serviceProvider = applicationManagementServiceClient.getApplication(appName);
    InboundAuthenticationRequestConfig requestConfig = new InboundAuthenticationRequestConfig();
    requestConfig.setInboundAuthKey(consumerKey);
    requestConfig.setInboundAuthType("oauth2");
    if (StringUtils.isNotBlank(consumerSecret)) {
        Property property = new Property();
        property.setName("oauthConsumerSecret");
        property.setValue(consumerSecret);
        Property[] properties = { property };
        requestConfig.setProperties(properties);
    }
    InboundAuthenticationConfig inboundAuthenticationConfig = new InboundAuthenticationConfig();
    inboundAuthenticationConfig.setInboundAuthenticationRequestConfigs(new InboundAuthenticationRequestConfig[] { requestConfig });
    serviceProvider.setInboundAuthenticationConfig(inboundAuthenticationConfig);
    LocalAndOutboundAuthenticationConfig outboundAuthConfig = createLocalAndOutboundAuthenticationConfig();
    outboundAuthConfig.setEnableAuthorization(false);
    AuthenticationScriptConfig config = new AuthenticationScriptConfig();
    config.setContent(script);
    config.setEnabled(true);
    outboundAuthConfig.setAuthenticationScriptConfig(config);
    serviceProvider.setLocalAndOutBoundAuthenticationConfig(outboundAuthConfig);
    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) AuthenticationScriptConfig(org.wso2.carbon.identity.application.common.model.script.xsd.AuthenticationScriptConfig) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) OAuthConsumerAppDTO(org.wso2.carbon.identity.oauth.stub.dto.OAuthConsumerAppDTO) InboundAuthenticationRequestConfig(org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig) Property(org.wso2.carbon.identity.application.common.model.xsd.Property) IdentityProviderProperty(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProviderProperty)

Example 18 with LocalAndOutboundAuthenticationConfig

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

the class AbstractAdaptiveAuthenticationTestCase method createLocalAndOutboundAuthenticationConfig.

/**
 * Create the AdvancedAuthenticator with Multi steps.
 * Use any attributes needed if needed to do multiple tests with different advanced authenticators.
 *
 * @throws Exception
 */
protected LocalAndOutboundAuthenticationConfig createLocalAndOutboundAuthenticationConfig() throws Exception {
    LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = new LocalAndOutboundAuthenticationConfig();
    localAndOutboundAuthenticationConfig.setAuthenticationType("flow");
    AuthenticationStep authenticationStep1 = new AuthenticationStep();
    authenticationStep1.setStepOrder(1);
    LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
    localConfig.setName(CommonConstants.BASIC_AUTHENTICATOR);
    localConfig.setDisplayName("basicauth");
    localConfig.setEnabled(true);
    authenticationStep1.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
    authenticationStep1.setSubjectStep(true);
    authenticationStep1.setAttributeStep(true);
    localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep1);
    return localAndOutboundAuthenticationConfig;
}
Also used : LocalAndOutboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig) LocalAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig) AuthenticationStep(org.wso2.carbon.identity.application.common.model.xsd.AuthenticationStep)

Example 19 with LocalAndOutboundAuthenticationConfig

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

the class RiskBasedLoginTestCase method createLocalAndOutboundAuthenticationConfig.

protected LocalAndOutboundAuthenticationConfig createLocalAndOutboundAuthenticationConfig() throws Exception {
    LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = super.createLocalAndOutboundAuthenticationConfig();
    AuthenticationStep authenticationStep2 = new AuthenticationStep();
    authenticationStep2.setStepOrder(2);
    LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
    localConfig.setName("DemoFingerprintAuthenticator");
    localConfig.setDisplayName("Demo Fingerprint Authenticator");
    localConfig.setEnabled(true);
    authenticationStep2.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
    authenticationStep2.setSubjectStep(false);
    authenticationStep2.setAttributeStep(false);
    localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep2);
    return localAndOutboundAuthenticationConfig;
}
Also used : LocalAndOutboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig) LocalAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig) AuthenticationStep(org.wso2.carbon.identity.application.common.model.xsd.AuthenticationStep)

Example 20 with LocalAndOutboundAuthenticationConfig

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

the class EmailOTPTestCase method getLocalAndOutBoundAuthenticator.

private LocalAndOutboundAuthenticationConfig getLocalAndOutBoundAuthenticator() throws Exception {
    LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = new LocalAndOutboundAuthenticationConfig();
    // This will add basic authentication as the first step for authentication.
    AuthenticationStep authenticationStepOne = new AuthenticationStep();
    authenticationStepOne.setStepOrder(1);
    LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
    localConfig.setName(CommonConstants.BASIC_AUTHENTICATOR);
    localConfig.setDisplayName("basicauth");
    localConfig.setEnabled(true);
    authenticationStepOne.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
    localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStepOne);
    // This will add email otp as the second step for authentication.
    AuthenticationStep authenticationStepTwo = new AuthenticationStep();
    authenticationStepTwo.setStepOrder(2);
    authenticationStepTwo.setSubjectStep(false);
    authenticationStepTwo.setAttributeStep(false);
    authenticationStepTwo.setFederatedIdentityProviders(new IdentityProvider[] { getEmailOTPIdP() });
    localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStepTwo);
    return localAndOutboundAuthenticationConfig;
}
Also used : LocalAndOutboundAuthenticationConfig(org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig) LocalAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig) AuthenticationStep(org.wso2.carbon.identity.application.common.model.xsd.AuthenticationStep)

Aggregations

LocalAndOutboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.LocalAndOutboundAuthenticationConfig)24 LocalAndOutboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.xsd.LocalAndOutboundAuthenticationConfig)13 ServiceProvider (org.wso2.carbon.identity.application.common.model.ServiceProvider)12 AuthenticationStep (org.wso2.carbon.identity.application.common.model.AuthenticationStep)8 ClaimConfig (org.wso2.carbon.identity.application.common.model.ClaimConfig)7 AuthenticationStep (org.wso2.carbon.identity.application.common.model.xsd.AuthenticationStep)7 PreparedStatement (java.sql.PreparedStatement)6 ArrayList (java.util.ArrayList)6 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)6 Test (org.testng.annotations.Test)6 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)6 LocalAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.xsd.LocalAuthenticatorConfig)6 NamedPreparedStatement (org.wso2.carbon.database.utils.jdbc.NamedPreparedStatement)5 IdentityApplicationManagementException (org.wso2.carbon.identity.application.common.IdentityApplicationManagementException)5 ResultSet (java.sql.ResultSet)4 LocalAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.LocalAuthenticatorConfig)4 User (org.wso2.carbon.identity.application.common.model.User)4 InboundAuthenticationConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationConfig)4 InboundAuthenticationRequestConfig (org.wso2.carbon.identity.application.common.model.xsd.InboundAuthenticationRequestConfig)4 ApplicationConfig (org.wso2.carbon.identity.application.authentication.framework.config.model.ApplicationConfig)3