use of org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig in project product-is by wso2.
the class AbstractAdaptiveAuthenticationTestCase method updateResidentIDP.
protected void updateResidentIDP(IdentityProvider residentIdentityProvider) throws Exception {
FederatedAuthenticatorConfig[] federatedAuthenticatorConfigs = residentIdentityProvider.getFederatedAuthenticatorConfigs();
for (FederatedAuthenticatorConfig authenticatorConfig : federatedAuthenticatorConfigs) {
if (!authenticatorConfig.getName().equalsIgnoreCase("samlsso")) {
federatedAuthenticatorConfigs = (FederatedAuthenticatorConfig[]) ArrayUtils.removeElement(federatedAuthenticatorConfigs, authenticatorConfig);
}
}
residentIdentityProvider.setFederatedAuthenticatorConfigs(federatedAuthenticatorConfigs);
superTenantIDPMgtClient.updateResidentIdP(residentIdentityProvider);
}
use of org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig in project product-is by wso2.
the class IdentityProviderMgtServiceTestCase method atEnd.
@AfterClass(alwaysRun = true)
public void atEnd() throws Exception {
// Delete the Idp tested.
idpMgtServiceClient.deleteIdP(testIdpNameSearch);
// Restore default values for changes made to resident IDP
IdentityProvider residentProvider = idpMgtServiceClient.getResidentIdP();
Assert.assertNotNull(residentProvider, "Resident idp retrieval failed to restoring");
// restore resident identity provider
IdentityProvider identityProvider = new IdentityProvider();
identityProvider.setEnable(residentIdpEnable);
identityProvider.setPrimary(residentIdpPrimary);
identityProvider.setIdentityProviderName(residentIdpName);
identityProvider.setHomeRealmId(residentIDPDefaultRealm);
identityProvider.setIdpProperties(idpProperties);
FederatedAuthenticatorConfig samlFedAuthn = new FederatedAuthenticatorConfig();
samlFedAuthn.setName(SAML2SSO_NAME);
Property[] properties = new Property[1];
Property property = new Property();
property.setName(SAML2SSO_IDP_ENTITY_ID);
property.setValue(defaultSamlSSOEntityID);
properties[0] = property;
samlFedAuthn.setProperties(properties);
FederatedAuthenticatorConfig[] federatedAuthenticators = new FederatedAuthenticatorConfig[1];
federatedAuthenticators[0] = samlFedAuthn;
identityProvider.setFederatedAuthenticatorConfigs(federatedAuthenticators);
idpMgtServiceClient.updateResidentIdP(identityProvider);
log.info("resident idp restored");
}
use of org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig in project product-is by wso2.
the class IdentityProviderMgtServiceTestCase method testAddIdp.
@Test(priority = 2, groups = "wso2.is", description = "Test addIdp operation")
public void testAddIdp() throws Exception {
String testIdpDescription = "This is test identity provider";
String testIdpRealmId = "localhost";
String testFedAuthDispName = "openid";
String testFedAuthPropName = "OpenIdUrl";
String testFedAuthPropValue = "https://testDomain:9853/openid";
String testFedAuthPropName2 = "IsUserIdInClaims";
String testFedAuthPropValue2 = "false";
String testFedAuthPropName3 = "RealmId";
String testFedAuthPropValue3 = "localhost";
String testProvisionConfName = "scim";
String testProvisionPropName = "scim-user-ep";
String testProvisionPropDisplayName = "userEndPoint";
String testProvisionPropValue = "https://localhost:9853/testProvisionLink";
String testProvisionPropName2 = "scim-username";
String testProvisionPropDisplayName2 = "userName";
String testProvisionPropValue2 = "admin";
String testProvisionPropName3 = "scim-password";
String testProvisionPropDisplayName3 = "userPassword";
String testProvisionPropValue3 = "admin";
IdentityProvider idProvider = new IdentityProvider();
FederatedAuthenticatorConfig[] fedAuthConfigs = new FederatedAuthenticatorConfig[1];
// set idp information
idProvider.setHomeRealmId(testIdpRealmId);
idProvider.setEnable(true);
idProvider.setIdentityProviderDescription(testIdpDescription);
idProvider.setIdentityProviderName(testIdpName);
idProvider.setCertificate(sampleCertificate);
idProvider.setFederationHub(false);
idProvider.setPrimary(false);
// Add federated authentication configuration
FederatedAuthenticatorConfig authConfig = new FederatedAuthenticatorConfig();
authConfig.setDisplayName(testFedAuthDispName);
authConfig.setEnabled(true);
authConfig.setName(testFedAuthName);
// set properties
// property 1
Property fedProp = new Property();
fedProp.setName(testFedAuthPropName);
fedProp.setValue(testFedAuthPropValue);
// property 2
Property fedProp2 = new Property();
fedProp2.setName(testFedAuthPropName2);
fedProp2.setValue(testFedAuthPropValue2);
// property 3
Property fedProp3 = new Property();
fedProp3.setName(testFedAuthPropName3);
fedProp3.setValue(testFedAuthPropValue3);
Property[] props = new Property[3];
props[0] = fedProp;
props[1] = fedProp2;
props[2] = fedProp3;
authConfig.setProperties(props);
fedAuthConfigs[0] = authConfig;
idProvider.setFederatedAuthenticatorConfigs(fedAuthConfigs);
// Set JIT config
JustInTimeProvisioningConfig jitConfig = new JustInTimeProvisioningConfig();
jitConfig.setProvisioningEnabled(true);
idProvider.setJustInTimeProvisioningConfig(jitConfig);
ProvisioningConnectorConfig provisioningConfig = new ProvisioningConnectorConfig();
provisioningConfig.setName(testProvisionConfName);
provisioningConfig.setValid(false);
provisioningConfig.setBlocking(false);
provisioningConfig.setEnabled(true);
// set provisioning properties
Property provisionProp = new Property();
provisionProp.setName(testProvisionPropName);
provisionProp.setDisplayName(testProvisionPropDisplayName);
provisionProp.setValue(testProvisionPropValue);
Property provisionProp2 = new Property();
provisionProp2.setName(testProvisionPropName2);
provisionProp2.setDisplayName(testProvisionPropDisplayName2);
provisionProp2.setValue(testProvisionPropValue2);
Property provisionProp3 = new Property();
provisionProp3.setName(testProvisionPropName3);
provisionProp3.setDisplayName(testProvisionPropDisplayName3);
provisionProp3.setValue(testProvisionPropValue3);
Property[] provisionProps = new Property[3];
provisionProps[0] = provisionProp;
provisionProps[1] = provisionProp2;
provisionProps[2] = provisionProp3;
provisioningConfig.setProvisioningProperties(provisionProps);
ProvisioningConnectorConfig[] provisionConfigs = new ProvisioningConnectorConfig[1];
provisionConfigs[0] = provisioningConfig;
idProvider.setProvisioningConnectorConfigs(provisionConfigs);
// add new identity provider
idpMgtServiceClient.addIdP(idProvider);
// check adding idp success
IdentityProvider addedIdp = idpMgtServiceClient.getIdPByName(testIdpName);
Assert.assertNotNull(addedIdp, "addIdP or getIdPByName failed");
Assert.assertEquals(addedIdp.getHomeRealmId(), testIdpRealmId, "addIdP : setting home realm failed");
Assert.assertEquals(addedIdp.getCertificate(), sampleCertificate, "addIdP : setting certificate failed");
// idp auto enabled
Assert.assertEquals(addedIdp.getEnable(), true, "addIdP : idp enable failed");
Assert.assertEquals(addedIdp.getIdentityProviderDescription(), testIdpDescription, "addIdP : setting description failed");
Assert.assertEquals(addedIdp.getFederationHub(), false, "addIdP : setting federation hub status failed");
Assert.assertEquals(addedIdp.getPrimary(), false, "addIdP : setting primary status failed");
// Check added federated authenticator configs
FederatedAuthenticatorConfig[] addedFedAuth = addedIdp.getFederatedAuthenticatorConfigs();
Assert.assertNotNull(addedFedAuth, "federated authenticator not found");
Assert.assertEquals(addedFedAuth.length, 1, "addIdP : deviation from expected number of federated authenticators");
Assert.assertEquals(addedFedAuth[0].getName(), testFedAuthName, "addIdP : federated authenticator name setting failed");
Property[] fedAuthProps = addedFedAuth[0].getProperties();
Assert.assertNotNull(fedAuthProps, "addIdP : federated authenticator properties not found");
Assert.assertEquals(fedAuthProps.length, 3, "addIdP : Deviation of expected number of authenticator properties");
Map<String, Property> propertyMap = new HashMap<String, Property>();
for (Property fedAuthProp : fedAuthProps) {
propertyMap.put(fedAuthProp.getName(), fedAuthProp);
}
Assert.assertEquals(propertyMap.containsKey(testFedAuthPropName), true, "addIdP : federated authenticator property not found");
Assert.assertEquals(propertyMap.get(testFedAuthPropName).getValue(), testFedAuthPropValue, "Deviation of federated authenticator property value");
Assert.assertEquals(propertyMap.containsKey(testFedAuthPropName2), true, "addIdP : federated authenticator property not found");
Assert.assertEquals(propertyMap.get(testFedAuthPropName2).getValue(), testFedAuthPropValue2, "Deviation of federated authenticator property value");
Assert.assertEquals(propertyMap.containsKey(testFedAuthPropName3), true, "addIdP : federated authenticator property not found");
Assert.assertEquals(propertyMap.get(testFedAuthPropName3).getValue(), testFedAuthPropValue3, "Deviation of federated authenticator property value");
propertyMap.clear();
// check provisioning connector configs
ProvisioningConnectorConfig[] provisioningConfigs = addedIdp.getProvisioningConnectorConfigs();
Assert.assertNotNull(provisioningConfigs, "addIdP : provisioning connector not found");
Assert.assertEquals(provisioningConfigs.length, 1, "addIdP : Provisioning configuration property adding failed");
Assert.assertEquals(provisioningConfigs[0].getName(), testProvisionConfName, "addIdP : Provisioning configuration name setting failed");
Property[] provisioningProps = provisioningConfigs[0].getProvisioningProperties();
Assert.assertNotNull(provisioningProps, "addIdP : provisioning property not found");
Assert.assertEquals(provisioningProps.length, 4, "addIdP :Provisioning configuration property setting failed");
for (Property provisioningProp : provisioningProps) {
propertyMap.put(provisioningProp.getName(), provisioningProp);
}
Assert.assertEquals(propertyMap.containsKey(testProvisionPropName), true, "addIdP : Provisioning configuration property not found : " + testProvisionPropName);
Assert.assertEquals(propertyMap.get(testProvisionPropName).getValue(), testProvisionPropValue, "addIdP : Provisioning configuration property value failed : " + testProvisionPropName);
Assert.assertEquals(propertyMap.containsKey(testProvisionPropName2), true, "addIdP : Provisioning configuration property not found : " + testProvisionPropName2);
Assert.assertEquals(propertyMap.get(testProvisionPropName2).getValue(), testProvisionPropValue2, "addIdP : Provisioning configuration property value failed : " + testProvisionPropName2);
Assert.assertEquals(propertyMap.containsKey(testProvisionPropName3), true, "addIdP : Provisioning configuration property not found : " + testProvisionPropName3);
Assert.assertTrue(propertyMap.get(testProvisionPropName3).getValue().contains(RANDOM_PASSWORD_GENERATED), "addIdP : Provisioning configuration property value failed : " + testProvisionPropName3);
// check jit
Assert.assertEquals(addedIdp.getJustInTimeProvisioningConfig().getProvisioningEnabled(), true, "addIdP : JIT enabling failed");
}
use of org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig in project product-is by wso2.
the class IdentityProviderMgtServiceTestCase method addIdpForPagination.
private void addIdpForPagination() throws Exception {
String testIdpDescription = "This is second identity provider ";
String testIdpRealmId = "localhost";
String testFedAuthDispName = "openid";
IdentityProvider idProvider = new IdentityProvider();
// Set idp information.
idProvider.setHomeRealmId(testIdpRealmId);
idProvider.setEnable(true);
idProvider.setIdentityProviderDescription(testIdpDescription);
idProvider.setIdentityProviderName(testIdpNameSearch);
idProvider.setCertificate(sampleCertificate);
idProvider.setFederationHub(false);
idProvider.setPrimary(false);
// Add federated authentication configuration.
FederatedAuthenticatorConfig authConfig = new FederatedAuthenticatorConfig();
authConfig.setDisplayName(testFedAuthDispName);
authConfig.setEnabled(true);
authConfig.setName(testFedAuthName);
// Add new identity provider.
idpMgtServiceClient.addIdP(idProvider);
}
use of org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig in project product-is by wso2.
the class IdentityProviderMgtServiceTestCase method testGetResidentIdP.
@Test(priority = 1, groups = "wso2.is", description = "Test getResidentIdP operation")
public void testGetResidentIdP() throws Exception {
log.info("Retrieving resident identity provide");
IdentityProvider idProvider = idpMgtServiceClient.getResidentIdP();
Assert.assertNotNull(idProvider, "Resident identity provider retrieval failed");
sampleCertificate = idProvider.getCertificate();
// Extract authenticator configurations
FederatedAuthenticatorConfig[] authConfigs = idProvider.getFederatedAuthenticatorConfigs();
log.info("Authenticator configs : " + authConfigs.length);
// Extract provisioning configurations
ProvisioningConnectorConfig[] provisioningConfigs = idProvider.getProvisioningConnectorConfigs();
log.info("Provisioning configs : " + provisioningConfigs.length);
// check default identity provider name
Assert.assertEquals(idProvider.getIdentityProviderName(), "LOCAL", "Default resident identity provider name changed");
// check Default number of authentication configurations
Map<String, FederatedAuthenticatorConfig> fedAuthConfigMap = new HashMap<String, FederatedAuthenticatorConfig>();
for (FederatedAuthenticatorConfig config : authConfigs) {
fedAuthConfigMap.put(config.getName(), config);
}
Assert.assertEquals(fedAuthConfigMap.containsKey("openidconnect"), true, "Default auth config not found");
Assert.assertEquals(fedAuthConfigMap.containsKey("samlsso"), true, "Default auth config not found");
Assert.assertEquals(fedAuthConfigMap.containsKey("openid"), true, "Default auth config not found");
Assert.assertEquals(fedAuthConfigMap.containsKey("passivests"), true, "Default auth config not found");
// check Default number of provisioning configurations
Map<String, ProvisioningConnectorConfig> provisioningConfigMap = new HashMap<String, ProvisioningConnectorConfig>();
for (ProvisioningConnectorConfig config : provisioningConfigs) {
provisioningConfigMap.put(config.getName(), config);
}
Assert.assertEquals(provisioningConfigMap.containsKey("scim"), true, "Default provisioning config not found");
}
Aggregations