use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdentityProviderManagementServiceTest method addIdPData.
@DataProvider
public Object[][] addIdPData() {
// Initialize Test Identity Provider 1.
IdentityProvider idp1 = new IdentityProvider();
idp1.setIdentityProviderName("testIdP1");
idp1.setEnable(true);
idp1.setPrimary(true);
idp1.setFederationHub(true);
idp1.setCertificate("");
RoleMapping roleMapping1 = new RoleMapping(new LocalRole("1", "LocalRole1"), "Role1");
RoleMapping roleMapping2 = new RoleMapping(new LocalRole("2", "LocalRole2"), "Role2");
PermissionsAndRoleConfig permissionsAndRoleConfig = new PermissionsAndRoleConfig();
permissionsAndRoleConfig.setIdpRoles(new String[] { "Role1", "Role2" });
permissionsAndRoleConfig.setRoleMappings(new RoleMapping[] { roleMapping1, roleMapping2 });
idp1.setPermissionAndRoleConfig(permissionsAndRoleConfig);
FederatedAuthenticatorConfig federatedAuthenticatorConfig = new FederatedAuthenticatorConfig();
federatedAuthenticatorConfig.setDisplayName("DisplayName1");
federatedAuthenticatorConfig.setName("Name");
federatedAuthenticatorConfig.setEnabled(true);
Property property1 = new Property();
property1.setName("Property1");
property1.setValue("value1");
property1.setConfidential(false);
Property property2 = new Property();
property2.setName("Property2");
property2.setValue("value2");
property2.setConfidential(true);
federatedAuthenticatorConfig.setProperties(new Property[] { property1, property2 });
idp1.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { federatedAuthenticatorConfig });
ProvisioningConnectorConfig provisioningConnectorConfig1 = new ProvisioningConnectorConfig();
provisioningConnectorConfig1.setName("ProvisiningConfig1");
provisioningConnectorConfig1.setProvisioningProperties(new Property[] { property1 });
ProvisioningConnectorConfig provisioningConnectorConfig2 = new ProvisioningConnectorConfig();
provisioningConnectorConfig2.setName("ProvisiningConfig2");
provisioningConnectorConfig2.setProvisioningProperties(new Property[] { property2 });
provisioningConnectorConfig2.setEnabled(true);
provisioningConnectorConfig2.setBlocking(true);
idp1.setProvisioningConnectorConfigs(new ProvisioningConnectorConfig[] { provisioningConnectorConfig1, provisioningConnectorConfig2 });
ClaimConfig claimConfig = new ClaimConfig();
claimConfig.setLocalClaimDialect(false);
claimConfig.setRoleClaimURI("Country");
claimConfig.setUserClaimURI("Country");
ClaimMapping claimMapping = ClaimMapping.build("http://wso2.org/claims/country", "Country", "", true);
claimConfig.setClaimMappings(new ClaimMapping[] { claimMapping });
Claim remoteClaim = new Claim();
remoteClaim.setClaimId(0);
remoteClaim.setClaimUri("Country");
claimConfig.setIdpClaims(new Claim[] { remoteClaim });
idp1.setClaimConfig(claimConfig);
// Initialize Test Identity Provider 2.
IdentityProvider idp2 = new IdentityProvider();
idp2.setIdentityProviderName("testIdP2");
ClaimConfig claimConfig2 = new ClaimConfig();
claimConfig2.setLocalClaimDialect(true);
claimConfig2.setRoleClaimURI("http://wso2.org/claims/role");
claimConfig2.setUserClaimURI("http://wso2.org/claims/fullname");
ClaimMapping claimMapping2 = new ClaimMapping();
Claim localClaim2 = new Claim();
localClaim2.setClaimId(0);
localClaim2.setClaimUri("http://wso2.org/claims/fullname");
claimMapping2.setLocalClaim(localClaim2);
claimConfig2.setClaimMappings(new ClaimMapping[] { claimMapping2 });
idp2.setClaimConfig(claimConfig2);
// Initialize Test Identity Provider 3.
IdentityProvider idp3 = new IdentityProvider();
idp3.setIdentityProviderName("testIdP3");
return new Object[][] { // IDP with PermissionsAndRoleConfig,FederatedAuthenticatorConfigs,ProvisioningConnectorConfigs,Claims.
{ idp1 }, // IDP with Local Cliam Dialect ClaimConfigs.
{ idp2 }, // IDP with only the name.
{ idp3 } };
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdentityProviderManagementServiceTest method updateResidentIdPData.
@DataProvider
public Object[][] updateResidentIdPData() {
// Initialize New Resident Identity Provider 1.
IdentityProvider idp1New = new IdentityProvider();
idp1New.setIdentityProviderName("LOCAL");
IdentityProviderProperty idpProperty1 = new IdentityProviderProperty();
idpProperty1.setName(IdentityApplicationConstants.SESSION_IDLE_TIME_OUT);
idpProperty1.setValue("100");
IdentityProviderProperty idpProperty2 = new IdentityProviderProperty();
idpProperty2.setName(IdentityApplicationConstants.REMEMBER_ME_TIME_OUT);
idpProperty2.setValue("10000");
IdentityProviderProperty idpProperty3 = new IdentityProviderProperty();
idpProperty3.setName(IdentityApplicationConstants.Authenticator.SAML2SSO.SAML_METADATA_VALIDITY_PERIOD);
idpProperty3.setValue("10000");
IdentityProviderProperty idpProperty4 = new IdentityProviderProperty();
idpProperty4.setName(IdentityApplicationConstants.Authenticator.SAML2SSO.SAML_METADATA_SIGNING_ENABLED);
idpProperty4.setValue("true");
idp1New.setIdpProperties(new IdentityProviderProperty[] { idpProperty1, idpProperty2, idpProperty3, idpProperty4 });
// Initialize New Resident Identity Provider 2.
IdentityProvider idp2New = new IdentityProvider();
idp2New.setIdentityProviderName("LOCAL");
FederatedAuthenticatorConfig facNew = new FederatedAuthenticatorConfig();
facNew.setDisplayName("DisplayName1New");
facNew.setName("Name");
facNew.setEnabled(true);
idp2New.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { facNew });
// Initialize New Resident Identity Provider 3.
IdentityProvider idp3New = new IdentityProvider();
idp3New.setIdentityProviderName("LOCAL");
return new Object[][] { // New Resident IDP with new IDP Properties.
{ idp1New }, // New Resident IDP with new FederatedAuthenticatorConfigs.
{ idp2New }, // New Resident IDP with no object properties (only contains the name).
{ idp3New } };
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdentityProviderManagementServiceTest method removeTestIdps.
private void removeTestIdps() throws IdentityProviderManagementException {
IdentityProvider[] idpsFromDb = identityProviderManagementService.getAllIdPs();
for (IdentityProvider idp : idpsFromDb) {
// Remove current idps.
identityProviderManagementService.deleteIdP(idp.getIdentityProviderName());
}
// Remove resident idp.
identityProviderManagementService.deleteIdP("LOCAL");
// Remove shared idp.
identityProviderManagementService.deleteIdP("SHARED_IDP");
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdentityProviderManagementServiceTest method addIdPExceptionData.
@DataProvider
public Object[][] addIdPExceptionData() {
IdentityProvider idp1 = new IdentityProvider();
idp1.setIdentityProviderName("testIdP1");
IdentityProvider idp2 = new IdentityProvider();
idp2.setIdentityProviderName("SHARED_testIdP");
IdentityProvider idp3 = new IdentityProvider();
return new Object[][] { // Already existing IDP.
{ idp1 }, // IDP name with "SHARED_" prefix.
{ idp2 }, // IDP without a name.
{ idp3 } };
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdentityProviderManagementServiceTest method testGetResidentIdP.
@Test
public void testGetResidentIdP() throws Exception {
addResidentIdp();
IdentityProvider idpFromDb = identityProviderManagementService.getResidentIdP();
Assert.assertNotNull(idpFromDb);
Assert.assertEquals(idpFromDb.getIdentityProviderName(), "LOCAL");
}
Aggregations