use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdPManagementUIUtil method buildGoogleProvisioningConfiguration.
/**
* @param fedIdp
* @param paramMap
* @throws IdentityApplicationManagementException
*/
private static void buildGoogleProvisioningConfiguration(IdentityProvider fedIdp, Map<String, String> paramMap) throws IdentityApplicationManagementException {
ProvisioningConnectorConfig proConnector = new ProvisioningConnectorConfig();
proConnector.setName("googleapps");
Property domainName = null;
Property emailClaim = null;
Property givenNameClaim = null;
Property givenNameDefaultVal = null;
Property familyNameClaim = null;
Property familyNameDefault = null;
Property serviceAccEmail = null;
Property privateKey = null;
Property adminEmail = null;
Property appName = null;
Property googleProvPatten = null;
Property googleProvSeparator = null;
Property uniqueID = null;
String oldGooglePvtKey = null;
String newGooglePvtKey = null;
if (paramMap.get("googleProvEnabled") != null && "on".equals(paramMap.get("googleProvEnabled"))) {
proConnector.setEnabled(true);
} else {
proConnector.setEnabled(false);
}
if (paramMap.get("googleProvDefault") != null && "on".equals(paramMap.get("googleProvDefault"))) {
fedIdp.setDefaultProvisioningConnectorConfig(proConnector);
}
if (paramMap.get("google_prov_domain_name") != null) {
domainName = new Property();
domainName.setName("google_prov_domain_name");
domainName.setValue(paramMap.get("google_prov_domain_name"));
}
if (paramMap.get("google_prov_email_claim_dropdown") != null) {
emailClaim = new Property();
emailClaim.setName("google_prov_email_claim_dropdown");
emailClaim.setValue(paramMap.get("google_prov_email_claim_dropdown"));
}
if (paramMap.get("google_prov_givenname_claim_dropdown") != null) {
givenNameClaim = new Property();
givenNameClaim.setName("google_prov_givenname_claim_dropdown");
givenNameClaim.setValue(paramMap.get("google_prov_givenname_claim_dropdown"));
}
if (paramMap.get("google_prov_givenname") != null) {
givenNameDefaultVal = new Property();
givenNameDefaultVal.setName("google_prov_givenname");
givenNameDefaultVal.setValue(paramMap.get("google_prov_givenname"));
}
if (paramMap.get("google_prov_familyname_claim_dropdown") != null) {
familyNameClaim = new Property();
familyNameClaim.setName("google_prov_familyname_claim_dropdown");
familyNameClaim.setValue(paramMap.get("google_prov_familyname_claim_dropdown"));
}
if (paramMap.get("google_prov_familyname") != null) {
familyNameDefault = new Property();
familyNameDefault.setName("google_prov_familyname");
familyNameDefault.setValue(paramMap.get("google_prov_familyname"));
}
if (paramMap.get("google_prov_service_acc_email") != null) {
serviceAccEmail = new Property();
serviceAccEmail.setName("google_prov_service_acc_email");
serviceAccEmail.setValue(paramMap.get("google_prov_service_acc_email"));
}
if (paramMap.get("old_google_prov_private_key") != null) {
oldGooglePvtKey = paramMap.get("old_google_prov_private_key");
}
// get the value of the uploaded certificate.
if (paramMap.get("google_prov_private_key") != null) {
newGooglePvtKey = paramMap.get("google_prov_private_key");
}
if (newGooglePvtKey == null && oldGooglePvtKey != null) {
newGooglePvtKey = oldGooglePvtKey;
}
if (newGooglePvtKey != null) {
privateKey = new Property();
privateKey.setName("google_prov_private_key");
privateKey.setValue(newGooglePvtKey);
privateKey.setType(IdentityApplicationConstants.ConfigElements.PROPERTY_TYPE_BLOB);
}
if (paramMap.get("google_prov_admin_email") != null) {
adminEmail = new Property();
adminEmail.setName("google_prov_admin_email");
adminEmail.setValue(paramMap.get("google_prov_admin_email"));
}
if (paramMap.get("google_prov_application_name") != null) {
appName = new Property();
appName.setName("google_prov_application_name");
appName.setValue(paramMap.get("google_prov_application_name"));
}
if (paramMap.get("google_prov_pattern") != null) {
googleProvPatten = new Property();
googleProvPatten.setName("google_prov_pattern");
googleProvPatten.setValue(paramMap.get("google_prov_pattern"));
}
if (paramMap.get("google_prov_separator") != null) {
googleProvSeparator = new Property();
googleProvSeparator.setName("google_prov_separator");
googleProvSeparator.setValue(paramMap.get("google_prov_separator"));
}
if (paramMap.get("google-unique-id") != null) {
uniqueID = new Property();
uniqueID.setName("UniqueID");
uniqueID.setValue(paramMap.get("google-unique-id"));
}
Property[] proProperties = new Property[] { appName, adminEmail, privateKey, serviceAccEmail, familyNameDefault, familyNameClaim, givenNameDefaultVal, givenNameClaim, emailClaim, domainName, googleProvPatten, googleProvSeparator, uniqueID };
proConnector.setProvisioningProperties(proProperties);
ProvisioningConnectorConfig[] proConnectors = fedIdp.getProvisioningConnectorConfigs();
if (proConnector.getName() != null) {
if (proConnectors == null || proConnectors.length == 0) {
fedIdp.setProvisioningConnectorConfigs(new ProvisioningConnectorConfig[] { proConnector });
} else {
fedIdp.setProvisioningConnectorConfigs(concatArrays(new ProvisioningConnectorConfig[] { proConnector }, proConnectors));
}
}
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdPManagementUIUtil method buildPassiveSTSAuthenticationConfiguration.
/**
* @param fedIdp
* @param paramMap
* @throws IdentityApplicationManagementException
*/
private static void buildPassiveSTSAuthenticationConfiguration(IdentityProvider fedIdp, Map<String, String> paramMap) throws IdentityApplicationManagementException {
FederatedAuthenticatorConfig passiveSTSAuthnConfig = new FederatedAuthenticatorConfig();
passiveSTSAuthnConfig.setName("PassiveSTSAuthenticator");
passiveSTSAuthnConfig.setDisplayName("passivests");
if ("on".equals(paramMap.get("passiveSTSEnabled"))) {
passiveSTSAuthnConfig.setEnabled(true);
}
if ("on".equals(paramMap.get("passiveSTSDefault"))) {
fedIdp.setDefaultAuthenticatorConfig(passiveSTSAuthnConfig);
}
Property[] properties = new Property[6];
Property property = new Property();
property.setName(IdentityApplicationConstants.Authenticator.PassiveSTS.REALM_ID);
property.setValue(paramMap.get("passiveSTSRealm"));
properties[0] = property;
property = new Property();
property.setName(IdentityApplicationConstants.Authenticator.PassiveSTS.IDENTITY_PROVIDER_URL);
property.setValue(paramMap.get("passiveSTSUrl"));
properties[1] = property;
property = new Property();
property.setName(IdentityApplicationConstants.Authenticator.PassiveSTS.IS_USER_ID_IN_CLAIMS);
properties[2] = property;
if ("1".equals(paramMap.get("passive_sts_user_id_location"))) {
property.setValue("true");
;
} else {
property.setValue("false");
}
property = new Property();
property.setName(IdentityApplicationConstants.Authenticator.PassiveSTS.IS_ENABLE_ASSERTION_SIGNATURE_VALIDATION);
properties[3] = property;
if ("on".equals(paramMap.get("isEnablePassiveSTSAssertionSignatureValidation"))) {
property.setValue("true");
} else {
property.setValue("false");
}
property = new Property();
property.setName(IdentityApplicationConstants.Authenticator.PassiveSTS.IS_ENABLE_ASSERTION_AUDIENCE_VALIDATION);
properties[4] = property;
if ("on".equals(paramMap.get("isEnablePassiveSTSAssertionAudienceValidation"))) {
property.setValue("true");
} else {
property.setValue("false");
}
property = new Property();
property.setName("commonAuthQueryParams");
if (paramMap.get("passiveSTSQueryParam") != null && paramMap.get("passiveSTSQueryParam").trim().length() > 0) {
property.setValue(paramMap.get("passiveSTSQueryParam"));
}
properties[5] = property;
passiveSTSAuthnConfig.setProperties(properties);
FederatedAuthenticatorConfig[] authenticators = fedIdp.getFederatedAuthenticatorConfigs();
if (paramMap.get("passiveSTSUrl") != null && !"".equals(paramMap.get("passiveSTSUrl"))) {
if (authenticators == null || authenticators.length == 0) {
fedIdp.setFederatedAuthenticatorConfigs(new FederatedAuthenticatorConfig[] { passiveSTSAuthnConfig });
} else {
fedIdp.setFederatedAuthenticatorConfigs(concatArrays(new FederatedAuthenticatorConfig[] { passiveSTSAuthnConfig }, authenticators));
}
}
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class IdPManagementUIUtil method buildClaimConfiguration.
/**
* @param fedIdp
* @param paramMap
* @throws IdentityApplicationManagementException
*/
private static void buildClaimConfiguration(IdentityProvider fedIdp, Map<String, String> paramMap, List<String> idpClaims, ClaimMapping[] currentClaimMapping) throws IdentityApplicationManagementException {
ClaimConfig claimConfiguration = new ClaimConfig();
if (idpClaims != null && idpClaims.size() > 0) {
List<Claim> idPClaimList = new ArrayList<Claim>();
for (Iterator<String> iterator = idpClaims.iterator(); iterator.hasNext(); ) {
String claimUri = iterator.next();
Claim idpClaim = new Claim();
idpClaim.setClaimUri(claimUri);
idPClaimList.add(idpClaim);
}
claimConfiguration.setIdpClaims(idPClaimList.toArray(new Claim[idPClaimList.size()]));
}
claimConfiguration.setUserClaimURI(paramMap.get("user_id_claim_dropdown"));
claimConfiguration.setRoleClaimURI(paramMap.get("role_claim_dropdown"));
ClaimConfig claimConfigurationUpdated = claimMappingFromUI(claimConfiguration, paramMap);
fedIdp.setClaimConfig(claimConfigurationUpdated);
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class CacheBackedIdPMgtDAO method deleteIdPByResourceId.
/**
* @param resourceId
* @param tenantId
* @param tenantDomain
* @throws IdentityProviderManagementException
*/
public void deleteIdPByResourceId(String resourceId, int tenantId, String tenantDomain) throws IdentityProviderManagementException {
IdentityProvider identityProvider = this.getIdPByResourceId(resourceId, tenantId, tenantDomain);
if (identityProvider != null) {
String idPName = identityProvider.getIdentityProviderName();
if (idPMgtDAO.isIdpReferredBySP(idPName, tenantId)) {
String data = "Identity Provider '" + idPName + "' cannot be deleted as it is referred by Service " + "Providers.";
throw IdPManagementUtil.handleClientException(IdPManagementConstants.ErrorMessage.ERROR_CODE_DELETE_IDP, data);
}
idPMgtDAO.deleteIdPByResourceId(resourceId, tenantId, tenantDomain);
clearIdpCache(idPName, resourceId, tenantId, tenantDomain);
} else {
if (log.isDebugEnabled()) {
log.debug(String.format("IDP with resource ID: %s of tenantDomain:%s is not found is cache or DB", resourceId, tenantDomain));
}
}
}
use of org.wso2.carbon.identity.application.common.model.idp.xsd.IdentityProvider in project carbon-identity-framework by wso2.
the class CacheBackedIdPMgtDAO method forceDeleteIdP.
public void forceDeleteIdP(String idPName, int tenantId, String tenantDomain) throws IdentityProviderManagementException {
if (log.isDebugEnabled()) {
log.debug(String.format("Force deleting IDP:%s of tenantDomain:%s started.", idPName, tenantDomain));
}
// Remove cache entries related to the force deleted idps.
IdentityProvider identityProvider = this.getIdPByName(null, idPName, tenantId, tenantDomain);
if (identityProvider != null) {
idPMgtDAO.forceDeleteIdP(idPName, tenantId, tenantDomain);
clearIdpCache(idPName, tenantId, tenantDomain);
} else {
if (log.isDebugEnabled()) {
log.debug(String.format("IDP:%s of tenantDomain:%s is not found is cache or DB", idPName, tenantDomain));
}
}
if (log.isDebugEnabled()) {
log.debug(String.format("Force deleting IDP:%s of tenantDomain:%s completed.", idPName, tenantDomain));
}
}
Aggregations