use of org.wso2.carbon.identity.application.common.model.AuthenticationStep in project product-is by wso2.
the class SAMLIdentityFederationTestCase method testCreateServiceProviderInPrimaryIS.
@Test(priority = 2, groups = "wso2.is", description = "Check create service provider in primary IS")
public void testCreateServiceProviderInPrimaryIS() throws Exception {
super.addServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SERVICE_PROVIDER_NAME);
ServiceProvider serviceProvider = getServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SERVICE_PROVIDER_NAME);
Assert.assertNotNull(serviceProvider, "Failed to create service provider 'travelocity' in primary IS");
updateServiceProviderWithSAMLConfigs(PORT_OFFSET_0, PRIMARY_IS_SAML_ISSUER_NAME, PRIMARY_IS_SAML_ACS_URL, serviceProvider);
AuthenticationStep authStep = new AuthenticationStep();
org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider idP = new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider();
idP.setIdentityProviderName(IDENTITY_PROVIDER_NAME);
org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig saml2SSOAuthnConfig = new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig();
saml2SSOAuthnConfig.setName("SAMLSSOAuthenticator");
saml2SSOAuthnConfig.setDisplayName("samlsso");
idP.setFederatedAuthenticatorConfigs(new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig[] { saml2SSOAuthnConfig });
authStep.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { idP });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationSteps(new AuthenticationStep[] { authStep });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationType(AUTHENTICATION_TYPE);
updateServiceProvider(PORT_OFFSET_0, serviceProvider);
serviceProvider = getServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SERVICE_PROVIDER_NAME);
InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
boolean success = false;
if (configs != null) {
for (InboundAuthenticationRequestConfig config : configs) {
if (PRIMARY_IS_SAML_ISSUER_NAME.equals(config.getInboundAuthKey()) && INBOUND_AUTH_TYPE.equals(config.getInboundAuthType())) {
success = true;
break;
}
}
}
Assert.assertTrue(success, "Failed to update service provider with inbound SAML2 configs in primary IS");
Assert.assertEquals(serviceProvider.getLocalAndOutBoundAuthenticationConfig().getAuthenticationType(), AUTHENTICATION_TYPE, "Failed to update local and out bound configs in primary IS");
}
use of org.wso2.carbon.identity.application.common.model.AuthenticationStep in project product-is by wso2.
the class SAMLLocalAndOutboundAuthenticatorsTestCase method createAdvanceAuthenticatorWithMultiOptions.
/**
* Create the AdvancedAuthenticator with Multi options.
* Use any attributes needed if needed to do multiple tests with different advanced authenticators.
* @throws Exception
*/
private void createAdvanceAuthenticatorWithMultiOptions() throws Exception {
LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = new LocalAndOutboundAuthenticationConfig();
AuthenticationStep authenticationStep = new AuthenticationStep();
authenticationStep.setStepOrder(1);
LocalAuthenticatorConfig localConfig = new LocalAuthenticatorConfig();
localConfig.setName(CommonConstants.BASIC_AUTHENTICATOR);
localConfig.setDisplayName("basicauth");
localConfig.setEnabled(true);
authenticationStep.setLocalAuthenticatorConfigs(new LocalAuthenticatorConfig[] { localConfig });
authenticationStep.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { getFederatedGoogleIDP() });
authenticationStep.setSubjectStep(true);
authenticationStep.setAttributeStep(true);
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep);
config.getAuthenticator().setLocalAndOutboundAuthenticationConfig(localAndOutboundAuthenticationConfig);
}
use of org.wso2.carbon.identity.application.common.model.AuthenticationStep in project product-is by wso2.
the class ConditionalAuthenticationTestCase method createLocalAndOutboundAuthenticationConfig.
protected LocalAndOutboundAuthenticationConfig createLocalAndOutboundAuthenticationConfig() throws Exception {
LocalAndOutboundAuthenticationConfig localAndOutboundAuthenticationConfig = super.createLocalAndOutboundAuthenticationConfig();
AuthenticationStep authenticationStep2 = new AuthenticationStep();
authenticationStep2.setStepOrder(2);
authenticationStep2.setSubjectStep(false);
authenticationStep2.setAttributeStep(false);
authenticationStep2.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { getFederatedSAMLSSOIDP() });
localAndOutboundAuthenticationConfig.addAuthenticationSteps(authenticationStep2);
return localAndOutboundAuthenticationConfig;
}
use of org.wso2.carbon.identity.application.common.model.AuthenticationStep in project product-is by wso2.
the class OIDCFederatedIdpInitLogoutTest method createServiceProviderInPrimaryIS.
private void createServiceProviderInPrimaryIS() throws Exception {
super.addServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SP_NAME);
ServiceProvider serviceProvider = getServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SP_NAME);
Assert.assertNotNull(serviceProvider, "Failed to create service provider 'travelocity' in primary IS");
updateServiceProviderWithSAMLConfigs(PORT_OFFSET_0, PRIMARY_IS_SAML_ISSUER_NAME, PRIMARY_IS_SAML_ACS_URL, serviceProvider);
AuthenticationStep authStep = new AuthenticationStep();
org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider idP = new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider();
idP.setIdentityProviderName(PRIMARY_IS_IDP_NAME);
org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig oidcAuthnConfig = new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig();
oidcAuthnConfig.setName(PRIMARY_IS_IDP_AUTHENTICATOR_NAME_OIDC);
oidcAuthnConfig.setDisplayName("openidconnect");
idP.setFederatedAuthenticatorConfigs(new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig[] { oidcAuthnConfig });
authStep.setFederatedIdentityProviders(new org.wso2.carbon.identity.application.common.model.xsd.IdentityProvider[] { idP });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationSteps(new AuthenticationStep[] { authStep });
serviceProvider.getLocalAndOutBoundAuthenticationConfig().setAuthenticationType(PRIMARY_IS_SP_AUTHENTICATION_TYPE);
updateServiceProvider(PORT_OFFSET_0, serviceProvider);
serviceProvider = getServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SP_NAME);
InboundAuthenticationRequestConfig[] configs = serviceProvider.getInboundAuthenticationConfig().getInboundAuthenticationRequestConfigs();
boolean success = false;
if (configs != null) {
for (InboundAuthenticationRequestConfig config : configs) {
if (PRIMARY_IS_SP_INBOUND_AUTH_TYPE_SAMLSSO.equals(config.getInboundAuthType())) {
success = true;
break;
}
}
}
Assert.assertTrue(success, "Failed to update service provider with inbound SAML2 configs in primary IS");
Assert.assertTrue(PRIMARY_IS_SP_AUTHENTICATION_TYPE.equals(serviceProvider.getLocalAndOutBoundAuthenticationConfig().getAuthenticationType()), "Failed to update local and out bound configs in primary IS");
}
Aggregations