use of org.wso2.carbon.user.api.Property in project carbon-identity-framework by wso2.
the class IdPManagementUtil method removeRandomPasswords.
/**
* Use this method to replace random passwords with original passwords when original passwords are required
* @param identityProvider
* @param withCacheClear
*/
public static void removeRandomPasswords(IdentityProvider identityProvider, boolean withCacheClear) {
if (identityProvider == null || identityProvider.getProvisioningConnectorConfigs() == null) {
return;
}
for (ProvisioningConnectorConfig provisioningConnectorConfig : identityProvider.getProvisioningConnectorConfigs()) {
Property[] properties = provisioningConnectorConfig.getProvisioningProperties();
if (ArrayUtils.isEmpty(properties)) {
continue;
}
properties = RandomPasswordProcessor.getInstance().removeRandomPasswords(properties, withCacheClear);
provisioningConnectorConfig.setProvisioningProperties(properties);
}
}
use of org.wso2.carbon.user.api.Property in project carbon-identity-framework by wso2.
the class IdPManagementUtil method removeOriginalPasswords.
/**
* Use this method to replace original passwords with random passwords before sending to UI front-end
* @param identityProvider
* @return
*/
public static void removeOriginalPasswords(IdentityProvider identityProvider) {
if (identityProvider == null || identityProvider.getProvisioningConnectorConfigs() == null) {
return;
}
for (ProvisioningConnectorConfig provisioningConnectorConfig : identityProvider.getProvisioningConnectorConfigs()) {
Property[] properties = provisioningConnectorConfig.getProvisioningProperties();
if (ArrayUtils.isEmpty(properties)) {
continue;
}
properties = RandomPasswordProcessor.getInstance().removeOriginalPasswords(properties);
provisioningConnectorConfig.setProvisioningProperties(properties);
}
}
use of org.wso2.carbon.user.api.Property in project carbon-identity-framework by wso2.
the class RoleDAOImpl method getUserStoreProperty.
private String getUserStoreProperty(String property, int tenantId, String userStoreDomain) {
RealmService realmService = RoleManagementServiceComponentHolder.getInstance().getRealmService();
String propValue = null;
if (realmService != null) {
try {
if (IdentityUtil.getPrimaryDomainName().equals(userStoreDomain)) {
propValue = realmService.getTenantUserRealm(tenantId).getRealmConfiguration().getUserStoreProperty(property);
} else {
UserStoreManager userStoreManager = realmService.getTenantUserRealm(tenantId).getUserStoreManager();
if (userStoreManager instanceof AbstractUserStoreManager) {
propValue = ((AbstractUserStoreManager) userStoreManager).getSecondaryUserStoreManager(userStoreDomain).getRealmConfiguration().getUserStoreProperty(property);
}
}
} catch (UserStoreException e) {
log.error(String.format("Error while retrieving property %s for userstore %s in tenantId %s. " + "Returning null.", property, userStoreDomain, tenantId), e);
}
}
if (log.isDebugEnabled()) {
log.debug(String.format("Userstore property %s is set to %s for userstore %s in tenantId %s", property, propValue, userStoreDomain, tenantId));
}
return propValue;
}
use of org.wso2.carbon.user.api.Property in project carbon-identity-framework by wso2.
the class AbstractProvisioningConnectorFactory method getConnector.
/**
* @param identityProviderName
* @param provisoningProperties
* @param tenantDomain
* @return
* @throws IdentityProvisioningException
*/
public AbstractOutboundProvisioningConnector getConnector(String identityProviderName, Property[] provisoningProperties, String tenantDomain) throws IdentityProvisioningException {
ProvisioningConnectorCacheKey cacheKey = new ProvisioningConnectorCacheKey(identityProviderName);
ProvisioningConnectorCacheEntry entry = ProvisioningConnectorCache.getInstance().getValueFromCache(cacheKey, tenantDomain);
if (entry != null) {
if (log.isDebugEnabled()) {
log.debug("Provisioning cache HIT for " + identityProviderName + " of " + tenantDomain);
}
return entry.getProvisioningConnector();
}
AbstractOutboundProvisioningConnector connector;
Property idpName = new Property();
idpName.setName("identityProviderName");
idpName.setValue(identityProviderName);
List<Property> provisioningPropertiesList = new ArrayList<>(Arrays.asList(provisoningProperties));
provisioningPropertiesList.add(idpName);
Property[] provisioningProperties = new Property[provisioningPropertiesList.size()];
provisioningProperties = provisioningPropertiesList.toArray(provisioningProperties);
connector = buildConnector(provisioningProperties);
entry = new ProvisioningConnectorCacheEntry();
entry.setProvisioningConnector(connector);
ProvisioningConnectorCache.getInstance().addToCache(cacheKey, entry, tenantDomain);
return connector;
}
use of org.wso2.carbon.user.api.Property in project carbon-identity-framework by wso2.
the class IdentityProvisionServiceComponent method setProvisioningConnectorFactory.
@Reference(name = "provisioning.connector.factory", service = org.wso2.carbon.identity.provisioning.AbstractProvisioningConnectorFactory.class, cardinality = ReferenceCardinality.AT_LEAST_ONE, policy = ReferencePolicy.DYNAMIC, unbind = "unsetProvisioningConnectorFactory")
protected void setProvisioningConnectorFactory(AbstractProvisioningConnectorFactory connectorFactory) {
ProvisioningServiceDataHolder.getInstance().getConnectorFactories().put(connectorFactory.getConnectorType(), connectorFactory);
if (log.isDebugEnabled()) {
log.debug("Added provisioning connector : " + connectorFactory.getConnectorType());
}
ProvisioningConnectorConfig provisioningConnectorConfig = new ProvisioningConnectorConfig();
provisioningConnectorConfig.setName(connectorFactory.getConnectorType());
Property[] property = new Property[connectorFactory.getConfigurationProperties().size()];
provisioningConnectorConfig.setProvisioningProperties(connectorFactory.getConfigurationProperties().toArray(property));
ProvisioningConnectorService.getInstance().addProvisioningConnectorConfigs(provisioningConnectorConfig);
}
Aggregations