use of org.wso2.carbon.identity.governance.stub.bean.ConnectorConfig in project carbon-identity-framework by wso2.
the class IdentityProviderManager method validateOutboundProvisioningConnectorProperties.
/**
* Validate whether there are any duplicate properties in the ProvisioningConnectorConfig of an IdentityProvider.
*
* @param newIdentityProvider IdentityProvider object.
* @throws IdentityProviderManagementException If duplicate properties found in ProvisioningConnectorConfig.
*/
private void validateOutboundProvisioningConnectorProperties(IdentityProvider newIdentityProvider) throws IdentityProviderManagementException {
ProvisioningConnectorConfig[] provisioningConnectorConfigs = newIdentityProvider.getProvisioningConnectorConfigs();
if (!ArrayUtils.isEmpty(provisioningConnectorConfigs)) {
for (ProvisioningConnectorConfig connectorConfig : provisioningConnectorConfigs) {
Property[] properties = connectorConfig.getProvisioningProperties();
// If no properties have specified, validation needs to stop.
if (ArrayUtils.isEmpty(properties) || properties.length < 2) {
break;
}
Set<Property> connectorProperties = new HashSet<>();
for (Property property : properties) {
if (!connectorProperties.add(property)) {
throw IdPManagementUtil.handleClientException(IdPManagementConstants.ErrorMessage.DUPLICATE_OUTBOUND_CONNECTOR_PROPERTIES, newIdentityProvider.getIdentityProviderName());
}
}
}
}
}
use of org.wso2.carbon.identity.governance.stub.bean.ConnectorConfig in project carbon-identity-framework by wso2.
the class IdentityGovernanceAdminClient method getConnectorList.
public Map<String, Map<String, List<ConnectorConfig>>> getConnectorList() throws RemoteException, IdentityGovernanceAdminServiceIdentityGovernanceExceptionException {
ConnectorConfig[] configs = stub.getConnectorList();
Map<String, Map<String, List<ConnectorConfig>>> catMap = new HashMap<>();
if (configs != null) {
for (ConnectorConfig conf : configs) {
String categoryName = StringUtils.isBlank(conf.getCategory()) ? DEFAULT : conf.getCategory();
String subCategoryName = StringUtils.isBlank(conf.getSubCategory()) ? DEFAULT : conf.getSubCategory();
if (catMap.containsKey(categoryName)) {
Map<String, List<ConnectorConfig>> subCatMap = catMap.get(categoryName);
if (subCatMap.containsKey(subCategoryName)) {
List<ConnectorConfig> confList = subCatMap.get(subCategoryName);
confList.add(conf);
} else {
List<ConnectorConfig> confList = new ArrayList<ConnectorConfig>();
confList.add(conf);
subCatMap.put(subCategoryName, confList);
}
} else {
Map<String, List<ConnectorConfig>> subCatMap = new HashMap<String, List<ConnectorConfig>>();
catMap.put(categoryName, subCatMap);
List<ConnectorConfig> confList = new ArrayList<ConnectorConfig>();
confList.add(conf);
subCatMap.put(subCategoryName, confList);
}
}
}
return catMap;
}
use of org.wso2.carbon.identity.governance.stub.bean.ConnectorConfig in project carbon-identity-framework by wso2.
the class Util method isUserOnBoardingEnabled.
public static boolean isUserOnBoardingEnabled(ServletContext context, HttpSession session) {
if (!isAskPasswordAdminUIEnabled) {
return false;
}
String backendServerURL = CarbonUIUtil.getServerURL(context, session);
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
ConfigurationContext configContext = (ConfigurationContext) context.getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
Map<String, Map<String, List<ConnectorConfig>>> connectorList;
try {
IdentityGovernanceAdminClient client = new IdentityGovernanceAdminClient(cookie, backendServerURL, configContext);
connectorList = client.getConnectorList();
} catch (Exception e) {
log.error("Error while getting connector list from governance service, at URL :" + backendServerURL, e);
return false;
}
if (connectorList != null) {
for (Map.Entry<String, Map<String, List<ConnectorConfig>>> entry : connectorList.entrySet()) {
Map<String, List<ConnectorConfig>> subCatList = entry.getValue();
for (String subCatKey : subCatList.keySet()) {
List<ConnectorConfig> connectorConfigs = subCatList.get(subCatKey);
for (ConnectorConfig connectorConfig : connectorConfigs) {
Property[] properties = connectorConfig.getProperties();
for (Property property : properties) {
if (property != null) {
if (EMAIL_VERIFICATION_ENABLE_PROP_NAME.equals(property.getName())) {
String propValue = property.getValue();
boolean isEmailVerificationEnabled = false;
if (!StringUtils.isEmpty(propValue)) {
isEmailVerificationEnabled = Boolean.parseBoolean(propValue);
}
return isEmailVerificationEnabled;
}
}
}
}
}
}
}
return false;
}
use of org.wso2.carbon.identity.governance.stub.bean.ConnectorConfig in project carbon-identity-framework by wso2.
the class Util method getAskPasswordTempPassGenerator.
public static RandomPasswordGenerator getAskPasswordTempPassGenerator(ServletContext context, HttpSession session) {
if (!isAskPasswordAdminUIEnabled) {
return new DefaultPasswordGenerator();
}
String randomPasswordGenerationClass = "org.wso2.carbon.user.mgt.common.DefaultPasswordGenerator";
if (isUserOnBoardingEnabled(context, session)) {
String backendServerURL = CarbonUIUtil.getServerURL(context, session);
String cookie = (String) session.getAttribute(ServerConstants.ADMIN_SERVICE_COOKIE);
ConfigurationContext configContext = (ConfigurationContext) context.getAttribute(CarbonConstants.CONFIGURATION_CONTEXT);
Map<String, Map<String, List<ConnectorConfig>>> connectorList;
try {
IdentityGovernanceAdminClient client = new IdentityGovernanceAdminClient(cookie, backendServerURL, configContext);
connectorList = client.getConnectorList();
if (connectorList != null) {
for (Map.Entry<String, Map<String, List<ConnectorConfig>>> entry : connectorList.entrySet()) {
Map<String, List<ConnectorConfig>> subCatList = entry.getValue();
for (String subCatKey : subCatList.keySet()) {
List<ConnectorConfig> connectorConfigs = subCatList.get(subCatKey);
for (ConnectorConfig connectorConfig : connectorConfigs) {
Property[] properties = connectorConfig.getProperties();
for (Property property : properties) {
if (ASK_PASSWORD_TEMP_PASSWORD_GENERATOR.equals(property.getName())) {
randomPasswordGenerationClass = property.getValue();
}
}
}
}
}
}
} catch (Exception e) {
log.error("Error while getting connector list from governance service, at URL :" + backendServerURL, e);
}
} else {
String randomPasswordGenerationClassFromFile = IdentityUtil.getProperty(ASK_PASSWORD_TEMP_PASSWORD_GENERATOR);
if (StringUtils.isNotBlank(randomPasswordGenerationClassFromFile)) {
randomPasswordGenerationClass = randomPasswordGenerationClassFromFile;
}
}
try {
Class clazz = Class.forName(randomPasswordGenerationClass);
return (RandomPasswordGenerator) clazz.newInstance();
} catch (Exception e) {
log.error("Error while loading random password generator class. " + "Default random password generator would be used", e);
}
return new DefaultPasswordGenerator();
}
use of org.wso2.carbon.identity.governance.stub.bean.ConnectorConfig in project carbon-identity-framework by wso2.
the class IdentityGovernanceAdminClient method getConnectorList.
public Map<String, Map<String, List<ConnectorConfig>>> getConnectorList() throws RemoteException, IdentityGovernanceAdminServiceIdentityGovernanceExceptionException {
ConnectorConfig[] configs = stub.getConnectorList();
Map<String, Map<String, List<ConnectorConfig>>> catMap = new HashMap<>();
if (configs != null) {
for (ConnectorConfig conf : configs) {
String categoryName = StringUtils.isBlank(conf.getCategory()) ? DEFAULT : conf.getCategory();
String subCategoryName = StringUtils.isBlank(conf.getSubCategory()) ? DEFAULT : conf.getSubCategory();
Map<String, List<ConnectorConfig>> subCatMap = catMap.get(categoryName);
if (subCatMap == null) {
subCatMap = new HashMap<>();
catMap.put(categoryName, subCatMap);
}
List confList = subCatMap.get(subCategoryName);
if (confList == null) {
confList = new ArrayList();
subCatMap.put(subCategoryName, confList);
}
confList.add(conf);
}
}
return catMap;
}
Aggregations