use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProviderProperty in project carbon-identity-framework by wso2.
the class ApplicationManagementServiceImpl method addUserIdAsDefaultSubject.
private void addUserIdAsDefaultSubject(ServiceProvider serviceProvider) {
boolean containsUseUserIdForSubjectProp = false;
ArrayList<ServiceProviderProperty> serviceProviderProperties = new ArrayList<>(Arrays.asList(serviceProvider.getSpProperties()));
for (ServiceProviderProperty prop : serviceProviderProperties) {
if (IdentityApplicationConstants.USE_USER_ID_FOR_DEFAULT_SUBJECT.equals(prop.getName())) {
containsUseUserIdForSubjectProp = true;
break;
}
}
if (!containsUseUserIdForSubjectProp) {
ServiceProviderProperty useUserIdForSubject = new ServiceProviderProperty();
useUserIdForSubject.setName(IdentityApplicationConstants.USE_USER_ID_FOR_DEFAULT_SUBJECT);
useUserIdForSubject.setValue("true");
serviceProviderProperties.add(useUserIdForSubject);
serviceProvider.setSpProperties(serviceProviderProperties.toArray(new ServiceProviderProperty[0]));
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProviderProperty in project carbon-identity-framework by wso2.
the class ApplicationDAOImpl method addServiceProviderProperties.
/**
* Add Service provider properties
*
* @param dbConnection
* @param spId
* @param properties
* @throws SQLException
*/
private void addServiceProviderProperties(Connection dbConnection, int spId, List<ServiceProviderProperty> properties, int tenantId) throws SQLException {
PreparedStatement prepStmt = null;
try {
prepStmt = isH2DB() ? dbConnection.prepareStatement(ADD_SP_METADATA_H2) : dbConnection.prepareStatement(ADD_SP_METADATA);
for (ServiceProviderProperty property : properties) {
if (StringUtils.isNotBlank(property.getValue())) {
prepStmt.setInt(1, spId);
prepStmt.setString(2, property.getName());
prepStmt.setString(3, property.getValue());
prepStmt.setString(4, property.getDisplayName());
prepStmt.setInt(5, tenantId);
prepStmt.addBatch();
} else {
if (log.isDebugEnabled()) {
String msg = "SP property '%s' of Sp with id: %d of tenantId: %d is empty or null. " + "Not adding the property to 'SP_METADATA' table.";
log.debug(String.format(msg, property.getName(), spId, tenantId));
}
}
}
prepStmt.executeBatch();
} catch (DataAccessException e) {
String errorMsg = "Error while adding SP properties for SP ID: " + spId + " and tenant ID: " + tenantId;
throw new SQLException(errorMsg, e);
} finally {
IdentityApplicationManagementUtil.closeStatement(prepStmt);
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProviderProperty in project carbon-identity-framework by wso2.
the class ApplicationDAOImpl method readAndSetConfigurationsFromProperties.
private void readAndSetConfigurationsFromProperties(List<ServiceProviderProperty> propertyList, LocalAndOutboundAuthenticationConfig localAndOutboundConfig) {
// Override with changed values.
if (CollectionUtils.isNotEmpty(propertyList)) {
for (ServiceProviderProperty serviceProviderProperty : propertyList) {
String name = serviceProviderProperty.getName();
String value = serviceProviderProperty.getValue();
if (USE_DOMAIN_IN_ROLES.equals(name)) {
localAndOutboundConfig.setUseUserstoreDomainInRoles(value == null || Boolean.parseBoolean(value));
} else if (SKIP_CONSENT.equals(name)) {
localAndOutboundConfig.setSkipConsent(Boolean.parseBoolean(value));
} else if (SKIP_LOGOUT_CONSENT.equals(name)) {
localAndOutboundConfig.setSkipLogoutConsent(Boolean.parseBoolean(value));
}
}
}
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProviderProperty in project carbon-identity-framework by wso2.
the class ApplicationDAOImpl method buildUserStoreDomainInRolesProperty.
private ServiceProviderProperty buildUserStoreDomainInRolesProperty(ServiceProvider sp) {
ServiceProviderProperty property = new ServiceProviderProperty();
property.setName(USE_DOMAIN_IN_ROLES);
property.setDisplayName(USE_DOMAIN_IN_ROLE_DISPLAY_NAME);
property.setValue(String.valueOf(sp.getLocalAndOutBoundAuthenticationConfig().isUseUserstoreDomainInRoles()));
return property;
}
use of org.wso2.carbon.identity.application.common.model.xsd.ServiceProviderProperty in project carbon-identity-framework by wso2.
the class ApplicationDAOImpl method buildTemplateIdProperty.
private ServiceProviderProperty buildTemplateIdProperty(ServiceProvider sp) {
ServiceProviderProperty templateIdProperty = new ServiceProviderProperty();
templateIdProperty.setName(TEMPLATE_ID_SP_PROPERTY_NAME);
templateIdProperty.setDisplayName(TEMPLATE_ID_SP_PROPERTY_DISPLAY_NAME);
templateIdProperty.setValue(StringUtils.isNotBlank(sp.getTemplateId()) ? sp.getTemplateId() : StringUtils.EMPTY);
return templateIdProperty;
}
Aggregations