Search in sources :

Example 1 with CharonConfiguration

use of org.wso2.charon3.core.config.CharonConfiguration in project identity-inbound-provisioning-scim2 by wso2-extensions.

the class IdentitySCIMManager method registerCharonConfig.

/**
 * This create the basic operational configurations for charon
 */
private void registerCharonConfig() throws CharonException {
    try {
        // Config charon.
        // This values will be used in /ServiceProviderConfigResource endpoint and some default charon configs.
        CharonConfiguration charonConfiguration = CharonConfiguration.getInstance();
        SCIMConfigProcessor scimConfigProcessor = SCIMConfigProcessor.getInstance();
        charonConfiguration.setDocumentationURL(scimConfigProcessor.getProperty(SCIMCommonConstants.DOCUMENTATION_URL));
        charonConfiguration.setBulkSupport(Boolean.parseBoolean(scimConfigProcessor.getProperty(SCIMCommonConstants.BULK_SUPPORTED)), Integer.parseInt(scimConfigProcessor.getProperty(SCIMCommonConstants.BULK_MAX_OPERATIONS)), Integer.parseInt(scimConfigProcessor.getProperty(SCIMCommonConstants.BULK_MAX_PAYLOAD_SIZE)));
        charonConfiguration.setSortSupport(Boolean.parseBoolean(scimConfigProcessor.getProperty(SCIMCommonConstants.SORT_SUPPORTED)));
        charonConfiguration.setPatchSupport(Boolean.parseBoolean(scimConfigProcessor.getProperty(SCIMCommonConstants.PATCH_SUPPORTED)));
        charonConfiguration.setETagSupport(Boolean.parseBoolean(scimConfigProcessor.getProperty(SCIMCommonConstants.ETAG_SUPPORTED)));
        charonConfiguration.setChangePasswordSupport(Boolean.parseBoolean(scimConfigProcessor.getProperty(SCIMCommonConstants.CHNAGE_PASSWORD_SUPPORTED)));
        charonConfiguration.setFilterSupport(Boolean.parseBoolean(scimConfigProcessor.getProperty(SCIMCommonConstants.FILTER_SUPPORTED)), Integer.parseInt(scimConfigProcessor.getProperty(SCIMCommonConstants.FILTER_MAX_RESULTS)));
        charonConfiguration.setCountValueForPagination(Integer.parseInt(scimConfigProcessor.getProperty(SCIMCommonConstants.PAGINATION_DEFAULT_COUNT)));
        ArrayList<Object[]> schemaList = new ArrayList<>();
        for (AuthenticationSchema authenticationSchema : scimConfigProcessor.getAuthenticationSchemas()) {
            Object[] schema = { authenticationSchema.getName(), authenticationSchema.getDescription(), authenticationSchema.getSpecUri(), authenticationSchema.getDocumentationUri(), authenticationSchema.getType(), authenticationSchema.getPrimary() };
            schemaList.add(schema);
        }
        charonConfiguration.setAuthenticationSchemes(schemaList);
    } catch (Exception e) {
        throw new CharonException("Error in setting up charon configurations.", e);
    }
}
Also used : AuthenticationSchema(org.wso2.carbon.identity.scim2.common.utils.AuthenticationSchema) ArrayList(java.util.ArrayList) CharonException(org.wso2.charon3.core.exceptions.CharonException) CharonConfiguration(org.wso2.charon3.core.config.CharonConfiguration) UserStoreException(org.wso2.carbon.user.api.UserStoreException) CharonException(org.wso2.charon3.core.exceptions.CharonException) SCIMConfigProcessor(org.wso2.carbon.identity.scim2.common.utils.SCIMConfigProcessor)

Aggregations

ArrayList (java.util.ArrayList)1 AuthenticationSchema (org.wso2.carbon.identity.scim2.common.utils.AuthenticationSchema)1 SCIMConfigProcessor (org.wso2.carbon.identity.scim2.common.utils.SCIMConfigProcessor)1 UserStoreException (org.wso2.carbon.user.api.UserStoreException)1 CharonConfiguration (org.wso2.charon3.core.config.CharonConfiguration)1 CharonException (org.wso2.charon3.core.exceptions.CharonException)1