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");
}
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);
}
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);
}
}
}
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);
}
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");
}
Aggregations