Java源码示例:org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig
示例1
/**
* Get meta information about Identity Provider's outbound provisioning connectors.
*
* @return List of meta outbound provisioning connectors.
*/
public List<MetaOutboundConnectorListItem> getMetaOutboundConnectors() {
List<MetaOutboundConnectorListItem> metaOutboundConnectors = new ArrayList<>();
try {
ProvisioningConnectorConfig[] connectorConfigs = IdentityProviderServiceHolder.getIdentityProviderManager()
.getAllProvisioningConnectors();
if (ArrayUtils.isNotEmpty(connectorConfigs)) {
for (ProvisioningConnectorConfig connectorConfig : connectorConfigs) {
MetaOutboundConnectorListItem metaOutboundConnector = createMetaOutboundConnectorListItem
(connectorConfig);
metaOutboundConnectors.add(metaOutboundConnector);
}
}
return metaOutboundConnectors;
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_META_CONNECTORS, null);
}
}
示例2
/**
* Get meta information about a specific outbound provisioning connector supported by the IDPs.
*
* @param id Outbound Provisioning Connector ID.
* @return MetaOutboundConnector.
*/
public MetaOutboundConnector getMetaOutboundConnector(String id) {
String connectorName = base64URLDecode(id);
MetaOutboundConnector connector = null;
try {
ProvisioningConnectorConfig[] connectorConfigs = IdentityProviderServiceHolder.getIdentityProviderManager()
.getAllProvisioningConnectors();
if (ArrayUtils.isNotEmpty(connectorConfigs)) {
for (ProvisioningConnectorConfig connectorConfig : connectorConfigs) {
if (StringUtils.equals(connectorConfig.getName(), connectorName)) {
connector = createMetaOutboundConnector(connectorConfig);
break;
}
}
}
return connector;
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_META_CONNECTOR, id);
}
}
示例3
/**
* Get specific outbound provisioning connector of an Identity Provider.
*
* @param idpId Identity Provider resource ID.
* @param connectorId Outbound provisioning connector ID.
* @return OutboundConnector.
*/
public OutboundConnector getOutboundConnector(String idpId, String connectorId) {
try {
IdentityProvider idp =
IdentityProviderServiceHolder.getIdentityProviderManager().getIdPByResourceId(idpId, ContextLoader
.getTenantDomainFromContext(), true);
if (idp == null) {
throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_IDP_NOT_FOUND,
idpId);
}
ProvisioningConnectorConfig[] connectorConfigs = idp.getProvisioningConnectorConfigs();
if (connectorConfigs != null) {
for (ProvisioningConnectorConfig config : connectorConfigs) {
if (StringUtils.equals(config.getName(), base64URLDecode(connectorId))) {
return createOutboundConnector(connectorId, idp);
}
}
}
throw handleException(Response.Status.NOT_FOUND,
Constants.ErrorMessage.ERROR_CODE_CONNECTOR_NOT_FOUND_FOR_IDP, connectorId);
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_IDP_CONNECTOR, connectorId);
}
}
示例4
private OutboundConnectorListResponse createOutboundProvisioningResponse(IdentityProvider idp) {
ProvisioningConnectorConfig[] connectorConfigs = idp.getProvisioningConnectorConfigs();
List<OutboundConnectorListItem> connectors = new ArrayList<>();
if (connectorConfigs != null) {
for (ProvisioningConnectorConfig connectorConfig : connectorConfigs) {
OutboundConnectorListItem connectorListItem = new OutboundConnectorListItem();
connectorListItem.setConnectorId(base64URLEncode(connectorConfig.getName()));
connectorListItem.setName(connectorConfig.getName());
connectorListItem.setIsEnabled(connectorConfig.isEnabled());
connectorListItem.setSelf(
ContextLoader.buildURIForBody(String.format(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT +
"/%s/provisioning/outbound-connectors/%s", idp.getResourceId(),
base64URLEncode(connectorConfig.getName())))
.toString());
connectors.add(connectorListItem);
}
}
OutboundConnectorListResponse outboundConnectorListResponse = new OutboundConnectorListResponse();
outboundConnectorListResponse.setDefaultConnectorId(idp.getDefaultProvisioningConnectorConfig() != null ?
base64URLEncode(idp.getDefaultProvisioningConnectorConfig().getName()) : null);
outboundConnectorListResponse.setConnectors(connectors);
return outboundConnectorListResponse;
}
示例5
/**
* Creates a clone of IDP's provisioning connector config list to be modified during PUT request.
*
* @param connectorId Provisioning connector resource ID.
* @param configs IDP's provisioning connector configs.
* @return Clone of connector config array.
*/
private ProvisioningConnectorConfig[] createProvisioningConnectorArrayClone(String connectorId,
ProvisioningConnectorConfig[] configs) {
List<ProvisioningConnectorConfig> cloneList = new ArrayList<>();
try {
for (ProvisioningConnectorConfig config : configs) {
cloneList.add((ProvisioningConnectorConfig) BeanUtils.cloneBean(config));
}
return cloneList.toArray(new ProvisioningConnectorConfig[0]);
} catch (IllegalAccessException | InstantiationException | InvocationTargetException | NoSuchMethodException
e) {
throw handleException(Response.Status.INTERNAL_SERVER_ERROR, Constants.ErrorMessage
.ERROR_CODE_ERROR_UPDATING_IDP_CONNECTOR, connectorId);
}
}
示例6
/**
* Verify whether the sent connectorId is a supported outbound connector type by the server.
*
* @param connectorId Outbound Provisioning Connector ID.
* @return whether Connector is a supported one by the server.
* @throws IdentityProviderManagementException IdentityProviderManagementException.
*/
private boolean isValidConnector(String connectorId) throws IdentityProviderManagementException {
ProvisioningConnectorConfig[] supportedConnectorConfigs =
IdentityProviderServiceHolder.getIdentityProviderManager()
.getAllProvisioningConnectors();
if (supportedConnectorConfigs != null) {
String connectorName = base64URLDecode(connectorId);
for (ProvisioningConnectorConfig supportedConfig : supportedConnectorConfigs) {
if (StringUtils.equals(supportedConfig.getName(), connectorName)) {
return true;
}
}
}
return false;
}
示例7
/**
* Create internal provisioning connector config from external outbound connector PUT request.
*
* @param outboundConnectorId Outbound provisioning connector resource ID.
* @param connector Outbound provisioning connector PUT request.
* @return Internal Provisioning connector config.
*/
private ProvisioningConnectorConfig createProvisioningConnectorConfig(String outboundConnectorId,
OutboundConnectorPUTRequest connector) {
ProvisioningConnectorConfig connectorConfig = new ProvisioningConnectorConfig();
String connectorName = base64URLDecode(outboundConnectorId);
connectorConfig.setName(connectorName);
connectorConfig.setEnabled(connector.getIsEnabled());
connectorConfig.setBlocking(connector.getBlockingEnabled());
connectorConfig.setRulesEnabled(connector.getRulesEnabled());
List<Property> properties = connector.getProperties().stream()
.map(propertyToInternal)
.collect(Collectors.toList());
connectorConfig.setProvisioningProperties(properties.toArray(new Property[0]));
return connectorConfig;
}
示例8
@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);
}
示例9
/**
* Updates Outbound Provisioning Connectors
*
* @param identityProvider
* @param provisioningIdps
* @throws IdentityProviderManagementException
*/
private void updateOutboundProvisioningConnectors(IdentityProvider identityProvider,
IdentityProvider[] provisioningIdps)
throws IdentityProviderManagementException {
ProvisioningConnectorConfig[] idpProvisioningConnectorConfigs =
identityProvider.getProvisioningConnectorConfigs();
for (IdentityProvider idpProvider : provisioningIdps) {
if (StringUtils.equals(idpProvider.getIdentityProviderName(), identityProvider.getIdentityProviderName())) {
ProvisioningConnectorConfig defaultProvisioningConnectorConfig =
idpProvider.getDefaultProvisioningConnectorConfig();
for (ProvisioningConnectorConfig config : idpProvisioningConnectorConfigs) {
if (StringUtils.equals(config.getName(),
defaultProvisioningConnectorConfig.getName()) && !config.isEnabled()) {
throw new IdentityProviderManagementException(config.getName()
+ " outbound provisioning connector is referred by service providers.");
}
}
}
}
}
示例10
/**
* @param newProvisioningConnectorConfigs
* @param dbConnection
* @param idpId
* @throws IdentityProviderManagementException
* @throws SQLException
*/
private void updateProvisioningConnectorConfigs(
ProvisioningConnectorConfig[] newProvisioningConnectorConfigs, Connection dbConnection,
int idpId, int tenantId) throws IdentityProviderManagementException, SQLException {
PreparedStatement prepStmt = null;
ResultSet rs = null;
try {
deleteProvisioningConnectorConfigs(dbConnection, idpId);
if (newProvisioningConnectorConfigs != null
&& newProvisioningConnectorConfigs.length > 0) {
addProvisioningConnectorConfigs(newProvisioningConnectorConfigs, dbConnection,
idpId, tenantId);
}
} finally {
IdentityDatabaseUtil.closeAllConnections(null, rs, prepStmt);
}
}
示例11
/**
* 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);
}
}
示例12
/**
* 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);
}
}
示例13
/**
* @param newProvisioningConnectorConfigs
* @param dbConnection
* @param idpId
* @throws IdentityProviderManagementException
* @throws SQLException
*/
private void updateProvisioningConnectorConfigs(
ProvisioningConnectorConfig[] newProvisioningConnectorConfigs, Connection dbConnection,
int idpId, int tenantId) throws IdentityProviderManagementException, SQLException {
PreparedStatement prepStmt = null;
ResultSet rs = null;
try {
deleteProvisioningConnectorConfigs(dbConnection, idpId);
if (newProvisioningConnectorConfigs != null
&& newProvisioningConnectorConfigs.length > 0) {
addProvisioningConnectorConfigs(newProvisioningConnectorConfigs, dbConnection,
idpId, tenantId);
}
} finally {
IdentityDatabaseUtil.closeAllConnections(null, rs, prepStmt);
}
}
示例14
/**
* 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);
}
}
示例15
/**
* 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);
}
}
示例16
/**
* Get outbound provisioning connectors of a specific Identity Provider.
*
* @param idpId Identity Provider resource ID.
* @return OutboundConnectorListResponse.
*/
public OutboundConnectorListResponse getOutboundConnectors(String idpId) {
try {
IdentityProvider idp =
IdentityProviderServiceHolder.getIdentityProviderManager().getIdPByResourceId(idpId, ContextLoader
.getTenantDomainFromContext(), true);
if (idp == null) {
throw handleException(Response.Status.NOT_FOUND, Constants.ErrorMessage.ERROR_CODE_IDP_NOT_FOUND,
idpId);
}
OutboundConnectorListResponse listResponse = null;
String defaultConnectorId = null;
ProvisioningConnectorConfig[] connectorConfigs = idp.getProvisioningConnectorConfigs();
if (connectorConfigs != null) {
listResponse = new OutboundConnectorListResponse();
List<OutboundConnectorListItem> connectorList = new ArrayList<>();
for (ProvisioningConnectorConfig config : connectorConfigs) {
connectorList.add(createOutboundConnectorListItem(idpId, config));
if (idp.getDefaultProvisioningConnectorConfig() != null) {
defaultConnectorId = base64URLEncode(idp.getDefaultProvisioningConnectorConfig()
.getName());
}
}
listResponse.setDefaultConnectorId(defaultConnectorId);
listResponse.setConnectors(connectorList);
}
return listResponse;
} catch (IdentityProviderManagementException e) {
throw handleIdPException(e, Constants.ErrorMessage.ERROR_CODE_ERROR_RETRIEVING_IDP_CONNECTORS, idpId);
}
}
示例17
private MetaOutboundConnectorListItem createMetaOutboundConnectorListItem(ProvisioningConnectorConfig
connectorConfig) {
MetaOutboundConnectorListItem metaOutboundProvisioningConnector = new MetaOutboundConnectorListItem();
metaOutboundProvisioningConnector.setName(connectorConfig.getName());
String connectorId = base64URLEncode(connectorConfig.getName());
metaOutboundProvisioningConnector.setConnectorId(connectorId);
metaOutboundProvisioningConnector
.setSelf(ContextLoader.buildURIForBody(String.format(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT +
"/meta/outbound-provisioning-connectors/%s", connectorId)).toString());
return metaOutboundProvisioningConnector;
}
示例18
private MetaOutboundConnector createMetaOutboundConnector(ProvisioningConnectorConfig
connectorConfig) {
MetaOutboundConnector metaOutboundProvisioningConnector = new MetaOutboundConnector();
metaOutboundProvisioningConnector.setName(connectorConfig.getName());
metaOutboundProvisioningConnector.setDisplayName(connectorConfig.getName());
metaOutboundProvisioningConnector.setConnectorId(base64URLEncode(connectorConfig.getName()));
Property[] properties = connectorConfig.getProvisioningProperties();
List<MetaProperty> metaProperties = Arrays.stream(properties).map(propertyToExternalMeta).collect(Collectors
.toList());
metaOutboundProvisioningConnector.setProperties(metaProperties);
return metaOutboundProvisioningConnector;
}
示例19
private void updateOutboundConnectorConfig(IdentityProvider idp,
OutboundProvisioningRequest outboundProvisioningRequest) {
if (outboundProvisioningRequest != null) {
List<OutboundConnector> outboundConnectors = outboundProvisioningRequest.getConnectors();
String defaultConnectorId = outboundProvisioningRequest.getDefaultConnectorId();
ProvisioningConnectorConfig defaultConnectorConfig = null;
List<ProvisioningConnectorConfig> connectorConfigs = new ArrayList<>();
for (OutboundConnector connector : outboundConnectors) {
ProvisioningConnectorConfig connectorConfig = new ProvisioningConnectorConfig();
connectorConfig.setName(base64URLDecode(connector.getConnectorId()));
connectorConfig.setEnabled(connector.getIsEnabled());
if (connector.getProperties() != null) {
List<Property> properties = connector.getProperties().stream()
.map(propertyToInternal)
.collect(Collectors.toList());
connectorConfig.setProvisioningProperties(properties.toArray(new Property[0]));
}
connectorConfigs.add(connectorConfig);
if (StringUtils.equals(defaultConnectorId, connector.getConnectorId())) {
defaultConnectorConfig = connectorConfig;
}
}
if (StringUtils.isNotBlank(defaultConnectorId) && defaultConnectorConfig == null) {
throw handleException(Response.Status.BAD_REQUEST, Constants.ErrorMessage
.ERROR_CODE_INVALID_DEFAULT_OUTBOUND_CONNECTOR, null);
}
idp.setProvisioningConnectorConfigs(connectorConfigs.toArray(new ProvisioningConnectorConfig[0]));
idp.setDefaultProvisioningConnectorConfig(defaultConnectorConfig);
}
}
示例20
/**
* Return the position indicator of an outbound connector from the configured list of provisioning connector
* configs of an IDP.
*
* @param provConnectorConfigs Outbound provisioning connector configs of IDP.
* @param connectorId Outbound provisioning connector ID.
* @return Position of the specified connector in the config array.
*/
private int getExistingProvConfigPosition(ProvisioningConnectorConfig[] provConnectorConfigs, String connectorId) {
int configPos = -1;
if (provConnectorConfigs != null) {
for (int i = 0; i < provConnectorConfigs.length; i++) {
if (StringUtils.equals(provConnectorConfigs[i].getName(), base64URLDecode(connectorId))) {
configPos = i;
break;
}
}
}
return configPos;
}
示例21
private OutboundConnectorListItem createOutboundConnectorListItem(String idPId, ProvisioningConnectorConfig
config) {
String connectorId = base64URLEncode(config.getName());
OutboundConnectorListItem listItem = new OutboundConnectorListItem();
listItem.setConnectorId(connectorId);
listItem.setName(config.getName());
listItem.setIsEnabled(config.isEnabled());
listItem.setSelf(ContextLoader.buildURIForBody(String.format(V1_API_PATH_COMPONENT + IDP_PATH_COMPONENT +
"/%s/provisioning/outbound-connectors/%s", idPId, connectorId)).toString());
return listItem;
}
示例22
/**
* Create external OutboundConnector from Provisioning Config.
*
* @param connectorId Outbound provisioning connector resource ID.
* @param identityProvider Identity Provider information.
* @return External outbound connector.
*/
private OutboundConnector createOutboundConnector(String connectorId, IdentityProvider identityProvider) {
ProvisioningConnectorConfig[] connectorConfigs = identityProvider.getProvisioningConnectorConfigs();
if (ArrayUtils.isEmpty(connectorConfigs)) {
return null;
}
ProvisioningConnectorConfig config = null;
boolean isDefaultConnector = false;
String connectorName = base64URLDecode(connectorId);
for (ProvisioningConnectorConfig connectorConfig : connectorConfigs) {
if (StringUtils.equals(connectorConfig.getName(), connectorName)) {
config = connectorConfig;
}
}
if (identityProvider.getDefaultProvisioningConnectorConfig() != null && StringUtils.equals(identityProvider
.getDefaultProvisioningConnectorConfig().getName(), connectorName)) {
isDefaultConnector = true;
}
OutboundConnector outboundConnector = null;
if (config != null) {
outboundConnector = new OutboundConnector();
outboundConnector.setConnectorId(connectorId);
outboundConnector.setName(config.getName());
outboundConnector.setIsEnabled(config.isEnabled());
outboundConnector.setIsDefault(isDefaultConnector);
outboundConnector.setBlockingEnabled(config.isBlocking());
outboundConnector.setRulesEnabled(config.isRulesEnabled());
List<org.wso2.carbon.identity.api.server.idp.v1.model.Property> properties =
Arrays.stream(config
.getProvisioningProperties()).map(propertyToExternal)
.collect(Collectors.toList());
outboundConnector.setProperties(properties);
}
return outboundConnector;
}
示例23
private OutboundProvisioningConfiguration getOutboundProvisioningConfiguration(IdentityProvider identityProvider) {
ProvisioningConnectorConfig provisioningConfig =
identityProvider.getDefaultProvisioningConnectorConfig();
JustInTimeProvisioningConfig justInTimeProvisioningConfig =
identityProvider.getJustInTimeProvisioningConfig();
return new OutboundProvisioningConfiguration()
.idp(identityProvider.getIdentityProviderName())
.blocking(provisioningConfig.isBlocking())
.connector(provisioningConfig.getName())
.rules(provisioningConfig.isRulesEnabled())
.jit(justInTimeProvisioningConfig != null && justInTimeProvisioningConfig.isProvisioningEnabled());
}
示例24
protected void unsetProvisioningConnectorFactory(AbstractProvisioningConnectorFactory connectorFactory) {
ProvisioningServiceDataHolder.getInstance().getConnectorFactories().values().remove(connectorFactory);
ProvisioningConnectorConfig provisioningConnectorConfig = ProvisioningConnectorService.getInstance().getProvisioningConnectorByName(connectorFactory.getConnectorType());
ProvisioningConnectorService.getInstance().removeProvisioningConnectorConfigs(provisioningConnectorConfig);
if (log.isDebugEnabled()) {
log.debug("Removed provisioning connector : " + connectorFactory.getConnectorType());
}
}
示例25
public ProvisioningConnectorConfig getProvisioningConnectorByName(String name) {
for (ProvisioningConnectorConfig connectorConfig : provisioningConnectorConfigs) {
if (connectorConfig.getName().equals(name)) {
return connectorConfig;
}
}
return null;
}
示例26
/**
* @param o1
* @param o2
* @return
*/
public static ProvisioningConnectorConfig[] concatArrays(ProvisioningConnectorConfig[] o1,
ProvisioningConnectorConfig[] o2) {
ProvisioningConnectorConfig[] ret = new ProvisioningConnectorConfig[o1.length + o2.length];
System.arraycopy(o1, 0, ret, 0, o1.length);
System.arraycopy(o2, 0, ret, o1.length, o2.length);
return ret;
}
示例27
/**
* @param provisioningConnectors
* @param connectorType
* @return
*/
public static ProvisioningConnectorConfig getProvisioningConnector(
ProvisioningConnectorConfig[] provisioningConnectors, String connectorType) {
for (ProvisioningConnectorConfig connector : provisioningConnectors) {
if (connector.getName().equals(connectorType)) {
return connector;
}
}
return null;
}
示例28
@Test
public void shouldGenerateDifferentHashCodesForDifferentNames() {
ProvisioningConnectorConfig config1 = new ProvisioningConnectorConfig();
config1.setName("Name1");
config1.setProvisioningProperties(new Property[0]);
ProvisioningConnectorConfig config2 = new ProvisioningConnectorConfig();
config2.setName("Name2");
config2.setProvisioningProperties(new Property[0]);
assertNotEquals(config1.hashCode(), config2.hashCode());
}
示例29
@Test
public void shouldReturnFalseByEqualsForDifferentNames() {
ProvisioningConnectorConfig config1 = new ProvisioningConnectorConfig();
config1.setName("Name1");
config1.setProvisioningProperties(new Property[0]);
ProvisioningConnectorConfig config2 = new ProvisioningConnectorConfig();
config2.setName("Name2");
config2.setProvisioningProperties(new Property[0]);
assertFalse(config1.equals(config2));
}
示例30
/**
* Get the Provisioning Connectors registered in the system.
*
* @return <code>ProvisioningConnectorConfig</code> array.
* @throws IdentityProviderManagementException
*/
@Override
public ProvisioningConnectorConfig[] getAllProvisioningConnectors()
throws IdentityProviderManagementException {
List<ProvisioningConnectorConfig> connectorConfigs = ProvisioningConnectorService
.getInstance().getProvisioningConnectorConfigs();
if (connectorConfigs != null && connectorConfigs.size() > 0) {
return connectorConfigs.toArray(new ProvisioningConnectorConfig[0]);
}
return null;
}