Search in sources :

Example 41 with FederatedAuthenticatorConfig

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

the class OIDCFederatedIdpInitLogoutTest method createIdentityProviderInPrimaryIS.

private void createIdentityProviderInPrimaryIS() throws Exception {
    IdentityProvider identityProvider = new IdentityProvider();
    identityProvider.setIdentityProviderName(PRIMARY_IS_IDP_NAME);
    // Set JWKS Uri to identity provider.
    IdentityProviderProperty jwksUriProperty = new IdentityProviderProperty();
    jwksUriProperty.setName("jwksUri");
    jwksUriProperty.setValue(SECONDARY_IS_JWKS_URI);
    IdentityProviderProperty issuerProperty = new IdentityProviderProperty();
    issuerProperty.setName("idpIssuerName");
    issuerProperty.setValue(SECONDARY_IS_TOKEN_ENDPOINT);
    IdentityProviderProperty[] properties = { jwksUriProperty, issuerProperty };
    identityProvider.setIdpProperties(properties);
    FederatedAuthenticatorConfig oidcAuthnConfig = new FederatedAuthenticatorConfig();
    oidcAuthnConfig.setName(PRIMARY_IS_IDP_AUTHENTICATOR_NAME_OIDC);
    oidcAuthnConfig.setDisplayName("openidconnect");
    oidcAuthnConfig.setEnabled(true);
    oidcAuthnConfig.setProperties(getOIDCAuthnConfigProperties());
    identityProvider.setDefaultAuthenticatorConfig(oidcAuthnConfig);
    identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { oidcAuthnConfig });
    JustInTimeProvisioningConfig jitConfig = new JustInTimeProvisioningConfig();
    jitConfig.setProvisioningEnabled(true);
    jitConfig.setProvisioningUserStore("PRIMARY");
    identityProvider.setJustInTimeProvisioningConfig(jitConfig);
    super.addIdentityProvider(PORT_OFFSET_0, identityProvider);
    Assert.assertNotNull(getIdentityProvider(PORT_OFFSET_0, PRIMARY_IS_IDP_NAME), "Failed to create " + "Identity Provider 'trustedIdP' in primary IS");
}
Also used : IdentityProviderProperty(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProviderProperty) FederatedAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig) JustInTimeProvisioningConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.JustInTimeProvisioningConfig) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider)

Example 42 with FederatedAuthenticatorConfig

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

the class ChangeACSUrlTestCase method initTest.

@BeforeClass(alwaysRun = true)
public void initTest() throws Exception {
    super.initTest();
    String carbonHome = Utils.getResidentCarbonHome();
    File defaultTomlFile = getDeploymentTomlFile(carbonHome);
    File configuredTomlFile = new File(getISResourceLocation() + File.separator + "saml" + File.separator + "application_authentication_changed_acs.toml");
    serverConfigurationManager = new ServerConfigurationManager(isServer);
    serverConfigurationManager.applyConfigurationWithoutRestart(configuredTomlFile, defaultTomlFile, true);
    serverConfigurationManager.restartGracefully();
    super.initTest();
    super.createServiceClients(PORT_OFFSET_0, sessionCookie, new IdentityConstants.ServiceClientType[] { IdentityConstants.ServiceClientType.APPLICATION_MANAGEMENT, IdentityConstants.ServiceClientType.IDENTITY_PROVIDER_MGT, IdentityConstants.ServiceClientType.SAML_SSO_CONFIG });
    super.createServiceClients(PORT_OFFSET_1, null, new IdentityConstants.ServiceClientType[] { IdentityConstants.ServiceClientType.APPLICATION_MANAGEMENT, IdentityConstants.ServiceClientType.SAML_SSO_CONFIG });
    // create identity provider in primary IS
    IdentityProvider identityProvider = new IdentityProvider();
    identityProvider.setIdentityProviderName(IDENTITY_PROVIDER_NAME);
    FederatedAuthenticatorConfig saml2SSOAuthnConfig = new FederatedAuthenticatorConfig();
    saml2SSOAuthnConfig.setName("SAMLSSOAuthenticator");
    saml2SSOAuthnConfig.setDisplayName("samlsso");
    saml2SSOAuthnConfig.setEnabled(true);
    saml2SSOAuthnConfig.setProperties(getSAML2SSOAuthnConfigProperties());
    identityProvider.setDefaultAuthenticatorConfig(saml2SSOAuthnConfig);
    identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { saml2SSOAuthnConfig });
    super.addIdentityProvider(PORT_OFFSET_0, identityProvider);
    // create service provider in primary IS
    super.addServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SERVICE_PROVIDER_NAME);
    ServiceProvider serviceProvider = getServiceProvider(PORT_OFFSET_0, PRIMARY_IS_SERVICE_PROVIDER_NAME);
    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 saml2SSOAuthnConfigXsd = new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig();
    saml2SSOAuthnConfigXsd.setName("SAMLSSOAuthenticator");
    saml2SSOAuthnConfigXsd.setDisplayName("samlsso");
    idP.setFederatedAuthenticatorConfigs(new org.wso2.carbon.identity.application.common.model.xsd.FederatedAuthenticatorConfig[] { saml2SSOAuthnConfigXsd });
    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);
    // create service provider in secondary IS
    super.addServiceProvider(PORT_OFFSET_1, SECONDARY_IS_SERVICE_PROVIDER_NAME);
    serviceProvider = getServiceProvider(PORT_OFFSET_1, SECONDARY_IS_SERVICE_PROVIDER_NAME);
    updateServiceProviderWithSAMLConfigs(PORT_OFFSET_1, SECONDARY_IS_SAML_ISSUER_NAME, String.format(COMMON_AUTH_URL_CHANGED, DEFAULT_PORT + PORT_OFFSET_0), serviceProvider);
    updateServiceProvider(PORT_OFFSET_1, serviceProvider);
}
Also used : FederatedAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig) ServerConfigurationManager(org.wso2.carbon.integration.common.utils.mgt.ServerConfigurationManager) AuthenticationStep(org.wso2.carbon.identity.application.common.model.xsd.AuthenticationStep) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) IdentityConstants(org.wso2.identity.integration.test.utils.IdentityConstants) ServiceProvider(org.wso2.carbon.identity.application.common.model.xsd.ServiceProvider) File(java.io.File) BeforeClass(org.testng.annotations.BeforeClass)

Example 43 with FederatedAuthenticatorConfig

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

the class IDPMetadataTestCase method addIDPMetadata.

@Test
public void addIDPMetadata() throws Exception {
    String filePath = FrameworkPathUtil.getSystemResourceLocation() + "artifacts" + File.separator + "IS" + File.separator + "saml" + File.separator + "idp-metadata.xml";
    byte[] encoded = Files.readAllBytes(Paths.get(filePath));
    String metadataXml = new String(encoded, StandardCharsets.UTF_8);
    IdentityProvider identityProvider = new IdentityProvider();
    identityProvider.setIdentityProviderName(ENTITYID);
    buildSAMLAuthenticationConfiguration(identityProvider, metadataXml);
    identityProviderMgtServiceClient.addIdP(identityProvider);
    identityProvider = identityProviderMgtServiceClient.getIdPByName(ENTITYID);
    FederatedAuthenticatorConfig samlFederatedAuthenticatorConfig = null;
    FederatedAuthenticatorConfig[] federatedAuthenticatorConfigs = identityProvider.getFederatedAuthenticatorConfigs();
    for (int i = 0; i < federatedAuthenticatorConfigs.length; i++) {
        if ("SAMLSSOAuthenticator".equals(federatedAuthenticatorConfigs[i].getName())) {
            samlFederatedAuthenticatorConfig = federatedAuthenticatorConfigs[i];
            break;
        }
    }
    Assert.assertNotNull(identityProvider);
    Assert.assertNotNull(samlFederatedAuthenticatorConfig);
    Property[] properties = samlFederatedAuthenticatorConfig.getProperties();
    for (Property property : properties) {
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.IDP_ENTITY_ID.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), ENTITYID);
        }
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.SP_ENTITY_ID.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), SPENTITYID);
        }
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.SSO_URL.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), SSOURL);
        }
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.IS_AUTHN_REQ_SIGNED.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), IS_AUTHN_REQ_SIGNED);
        }
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.IS_LOGOUT_ENABLED.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), IS_LOGOUT_ENABLED);
        }
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.LOGOUT_REQ_URL.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), LOGOUT_REQ_URL);
        }
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.IS_ENABLE_ASSERTION_ENCRYPTION.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), IS_ENABLE_ASSERTION_ENCRYPTION);
        }
        if (IdentityApplicationConstants.Authenticator.SAML2SSO.IS_ENABLE_ASSERTION_SIGNING.equals(property.getName())) {
            Assert.assertEquals(property.getValue(), IS_ENABLE_ASSERTION_SIGNING);
        }
    }
}
Also used : FederatedAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) Property(org.wso2.carbon.identity.application.common.model.idp.xsd.Property) ISIntegrationTest(org.wso2.identity.integration.common.utils.ISIntegrationTest) Test(org.testng.annotations.Test)

Example 44 with FederatedAuthenticatorConfig

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

the class SAMLFederationDynamicQueryParametersTestCase method testIdpWithDynamicQueryParams.

@Test(groups = "wso2.is", description = "Test federated IDP creation with SAML Federated Authenticator")
public void testIdpWithDynamicQueryParams() throws Exception {
    IdentityProvider identityProvider = new IdentityProvider();
    identityProvider.setIdentityProviderName(IDENTITY_PROVIDER_NAME);
    FederatedAuthenticatorConfig saml2SSOAuthnConfig = new FederatedAuthenticatorConfig();
    saml2SSOAuthnConfig.setName("SAMLSSOAuthenticator");
    saml2SSOAuthnConfig.setDisplayName("samlsso");
    saml2SSOAuthnConfig.setEnabled(true);
    saml2SSOAuthnConfig.setProperties(getSAML2SSOAuthnConfigProperties());
    identityProvider.setDefaultAuthenticatorConfig(saml2SSOAuthnConfig);
    identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { saml2SSOAuthnConfig });
    idpMgtClient.addIdP(identityProvider);
    IdentityProvider idPByName = idpMgtClient.getIdPByName(IDENTITY_PROVIDER_NAME);
    Assert.assertNotNull(idPByName);
}
Also used : FederatedAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) Test(org.testng.annotations.Test)

Example 45 with FederatedAuthenticatorConfig

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

the class TestPassiveSTSFederation method testCreateIdentityProviderInPrimaryIS.

@Test(groups = "wso2.is", description = "Check create identity provider in primary IS")
public void testCreateIdentityProviderInPrimaryIS() throws Exception {
    IdentityProvider identityProvider = new IdentityProvider();
    identityProvider.setIdentityProviderName(IDENTITY_PROVIDER_NAME);
    FederatedAuthenticatorConfig saml2SSOAuthnConfig = new FederatedAuthenticatorConfig();
    saml2SSOAuthnConfig.setName("SAMLSSOAuthenticator");
    saml2SSOAuthnConfig.setDisplayName("samlsso");
    saml2SSOAuthnConfig.setEnabled(true);
    saml2SSOAuthnConfig.setProperties(getSAML2SSOAuthnConfigProperties());
    identityProvider.setDefaultAuthenticatorConfig(saml2SSOAuthnConfig);
    identityProvider.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { saml2SSOAuthnConfig });
    super.addIdentityProvider(PORT_OFFSET_0, identityProvider);
    Assert.assertNotNull(getIdentityProvider(PORT_OFFSET_0, IDENTITY_PROVIDER_NAME), "Failed to create Identity Provider 'trustedIdP' in primary IS");
}
Also used : FederatedAuthenticatorConfig(org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig) IdentityProvider(org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider) Test(org.testng.annotations.Test)

Aggregations

FederatedAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig)60 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)36 FederatedAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.idp.xsd.FederatedAuthenticatorConfig)29 Property (org.wso2.carbon.identity.application.common.model.Property)28 IdentityProviderProperty (org.wso2.carbon.identity.application.common.model.IdentityProviderProperty)25 ArrayList (java.util.ArrayList)21 IdentityProviderManagementException (org.wso2.carbon.idp.mgt.IdentityProviderManagementException)17 IdentityProvider (org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider)16 Test (org.testng.annotations.Test)14 Property (org.wso2.carbon.identity.application.common.model.idp.xsd.Property)14 HashMap (java.util.HashMap)12 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)11 LocalAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.LocalAuthenticatorConfig)10 IdentityProviderProperty (org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProviderProperty)10 ClaimConfig (org.wso2.carbon.identity.application.common.model.ClaimConfig)9 ClaimMapping (org.wso2.carbon.identity.application.common.model.ClaimMapping)8 LocalRole (org.wso2.carbon.identity.application.common.model.LocalRole)8 PermissionsAndRoleConfig (org.wso2.carbon.identity.application.common.model.PermissionsAndRoleConfig)8 Map (java.util.Map)7 DataProvider (org.testng.annotations.DataProvider)7