Search in sources :

Example 31 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project identity-api-server by wso2.

the class ServerIdpManagementService method createMetaOutboundConnectorListItem.

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;
}
Also used : MetaOutboundConnectorListItem(org.wso2.carbon.identity.api.server.idp.v1.model.MetaOutboundConnectorListItem)

Example 32 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project identity-api-server by wso2.

the class ServerIdpManagementService method createOutboundConnectorListItem.

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;
}
Also used : OutboundConnectorListItem(org.wso2.carbon.identity.api.server.idp.v1.model.OutboundConnectorListItem) MetaOutboundConnectorListItem(org.wso2.carbon.identity.api.server.idp.v1.model.MetaOutboundConnectorListItem)

Example 33 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project identity-api-server by wso2.

the class ServerIdpManagementService method createMetaOutboundConnector.

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;
}
Also used : MetaOutboundConnector(org.wso2.carbon.identity.api.server.idp.v1.model.MetaOutboundConnector) MetaProperty(org.wso2.carbon.identity.api.server.idp.v1.model.MetaProperty) IdentityProviderProperty(org.wso2.carbon.identity.application.common.model.IdentityProviderProperty) Property(org.wso2.carbon.identity.application.common.model.Property) SubProperty(org.wso2.carbon.identity.application.common.model.SubProperty) MetaProperty(org.wso2.carbon.identity.api.server.idp.v1.model.MetaProperty)

Example 34 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project identity-api-server by wso2.

the class ServerIdpManagementService method createOutboundConnector.

/**
 * 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;
}
Also used : OutboundConnector(org.wso2.carbon.identity.api.server.idp.v1.model.OutboundConnector) MetaOutboundConnector(org.wso2.carbon.identity.api.server.idp.v1.model.MetaOutboundConnector) IdentityProviderProperty(org.wso2.carbon.identity.application.common.model.IdentityProviderProperty) Property(org.wso2.carbon.identity.application.common.model.Property) SubProperty(org.wso2.carbon.identity.application.common.model.SubProperty) MetaProperty(org.wso2.carbon.identity.api.server.idp.v1.model.MetaProperty) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)

Example 35 with ProvisioningConnectorConfig

use of org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig in project identity-api-server by wso2.

the class ServerIdpManagementService method getMetaOutboundConnector.

/**
 * 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);
    }
}
Also used : MetaOutboundConnector(org.wso2.carbon.identity.api.server.idp.v1.model.MetaOutboundConnector) IdentityProviderManagementException(org.wso2.carbon.idp.mgt.IdentityProviderManagementException) ProvisioningConnectorConfig(org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)

Aggregations

ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.ProvisioningConnectorConfig)39 IdentityProvider (org.wso2.carbon.identity.application.common.model.IdentityProvider)19 IdentityProviderProperty (org.wso2.carbon.identity.application.common.model.IdentityProviderProperty)19 Property (org.wso2.carbon.identity.application.common.model.Property)19 ArrayList (java.util.ArrayList)17 IdentityProviderManagementException (org.wso2.carbon.idp.mgt.IdentityProviderManagementException)14 ClaimConfig (org.wso2.carbon.identity.application.common.model.ClaimConfig)10 FederatedAuthenticatorConfig (org.wso2.carbon.identity.application.common.model.FederatedAuthenticatorConfig)10 ProvisioningConnectorConfig (org.wso2.carbon.identity.application.common.model.idp.xsd.ProvisioningConnectorConfig)10 PreparedStatement (java.sql.PreparedStatement)9 Property (org.wso2.carbon.identity.application.common.model.idp.xsd.Property)9 Test (org.testng.annotations.Test)8 Claim (org.wso2.carbon.identity.application.common.model.Claim)7 ClaimMapping (org.wso2.carbon.identity.application.common.model.ClaimMapping)7 LocalRole (org.wso2.carbon.identity.application.common.model.LocalRole)7 PermissionsAndRoleConfig (org.wso2.carbon.identity.application.common.model.PermissionsAndRoleConfig)7 RoleMapping (org.wso2.carbon.identity.application.common.model.RoleMapping)7 ResultSet (java.sql.ResultSet)6 HashMap (java.util.HashMap)6 JustInTimeProvisioningConfig (org.wso2.carbon.identity.application.common.model.JustInTimeProvisioningConfig)6