Package org.forgerock.opendj.rest2ldap
Class Rest2LdapJsonConfigurator
java.lang.Object
org.forgerock.opendj.rest2ldap.Rest2LdapJsonConfigurator
Provides core factory methods and builders for constructing Rest2Ldap endpoints from JSON configuration.
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.forgerock.opendj.ldap.ConnectionFactoryconfigureConnectionFactory(org.forgerock.json.JsonValue configuration, String name, TrustManager trustManager, X509KeyManager keyManager) Creates a new connection factory using the named configuration in the provided JSON list of factory configurations.static org.forgerock.opendj.ldap.ConnectionFactoryconfigureConnectionFactory(org.forgerock.json.JsonValue configuration, String name, TrustManager trustManager, X509KeyManager keyManager, ClassLoader providerClassLoader) Creates a new connection factory using the named configuration in the provided JSON list of factory configurations.static org.forgerock.json.resource.RequestHandlerconfigureEndpoint(File endpointDirectory, org.forgerock.util.Options options) Creates a new CRESTRequestHandlerrepresenting a single endpoint whose configuration is defined in the providedendpointDirectoryparameter.static org.forgerock.json.resource.RouterconfigureEndpoints(File endpointsDirectory, org.forgerock.util.Options options) Creates a new CRESTRouterusing the provided endpoints configuration directory and Rest2Ldap options.static X509KeyManagerconfigureKeyManager(org.forgerock.json.JsonValue configuration) Configures aX509KeyManagerusing the provided JSON configuration.static org.forgerock.util.OptionsconfigureOptions(org.forgerock.json.JsonValue config) Parses Rest2Ldap configuration options.configureResources(org.forgerock.json.JsonValue config) Parses a list of Rest2Ldap resource definitions.static TrustManagerconfigureTrustManager(org.forgerock.json.JsonValue configuration) Configures aTrustManagerusing the provided JSON configuration.
-
Method Details
-
configureOptions
Parses Rest2Ldap configuration options. The JSON configuration must have the following format:{ "readOnUpdatePolicy": "controls", "useSubtreeDelete": true, "usePermissiveModify": true, "useMvcc": true "mvccAttribute": "etag" }See the sample configuration file for a detailed description of its content.
- Parameters:
config- The JSON configuration.- Returns:
- The parsed Rest2Ldap configuration options.
- Throws:
IllegalArgumentException- If the configuration is invalid.
-
configureResources
Parses a list of Rest2Ldap resource definitions. The JSON configuration must have the following format:"top": { "isAbstract": true, "properties": { "_rev": { "type": "simple" "ldapAttribute": "etag", "writability": "readOnly" }, ... }, ... }, ...See the sample configuration file for a detailed description of its content.
- Parameters:
config- The JSON configuration.- Returns:
- The parsed list of Rest2Ldap resource definitions.
- Throws:
IllegalArgumentException- If the configuration is invalid.
-
configureEndpoints
public static org.forgerock.json.resource.Router configureEndpoints(File endpointsDirectory, org.forgerock.util.Options options) throws IOException Creates a new CRESTRouterusing the provided endpoints configuration directory and Rest2Ldap options. The Rest2Ldap configuration typically has the following structure on disk:- config.json - contains the configuration for the LDAP connection factories and authorization
- rest2ldap/rest2ldap.json - defines Rest2Ldap configuration options
- rest2ldap/endpoints/{api} - a directory containing the endpoint's resource definitions for endpoint {api}
- rest2ldap/endpoints/{api}/{resource-id}.json - the resource definitions for a specific version of API {api}. The name of the file, {resource-id}, determines which resource type definition in the mapping file will be used as the root resource.
- Parameters:
endpointsDirectory- The directory representing the Rest2Ldap "endpoints" directory.options- The Rest2Ldap configuration options.- Returns:
- A new CREST
Routerconfigured using the provided options and endpoints. - Throws:
IOException- If the endpoints configuration cannot be read.IllegalArgumentException- If the configuration is invalid.
-
configureEndpoint
public static org.forgerock.json.resource.RequestHandler configureEndpoint(File endpointDirectory, org.forgerock.util.Options options) throws IOException Creates a new CRESTRequestHandlerrepresenting a single endpoint whose configuration is defined in the providedendpointDirectoryparameter. The directory should contain a separate file for each supported version of the REST endpoint. The name of the file, excluding the suffix, identifies the resource definition which acts as the entry point into the endpoint.- Parameters:
endpointDirectory- The directory containing the endpoint's resource definitions, e.g. rest2ldap/routes/api would contain definitions for the "api" endpoint.options- The Rest2Ldap configuration options.- Returns:
- A new CREST
RequestHandlerconfigured using the provided options and endpoint mappings. - Throws:
IOException- If the endpoint configuration cannot be read.IllegalArgumentException- If the configuration is invalid.
-
configureKeyManager
Configures aX509KeyManagerusing the provided JSON configuration.- Parameters:
configuration- The JSON object containing the key manager configuration.- Returns:
- The configured key manager.
-
configureTrustManager
Configures aTrustManagerusing the provided JSON configuration.- Parameters:
configuration- The JSON object containing the trust manager configuration.- Returns:
- The configured trust manager.
-
configureConnectionFactory
public static org.forgerock.opendj.ldap.ConnectionFactory configureConnectionFactory(org.forgerock.json.JsonValue configuration, String name, TrustManager trustManager, X509KeyManager keyManager, ClassLoader providerClassLoader) Creates a new connection factory using the named configuration in the provided JSON list of factory configurations. See the sample configuration file for a detailed description of its content.- Parameters:
configuration- The JSON configuration.name- The name of the connection factory configuration to be parsed.trustManager- The trust manager to use for secure connection. Can benullto use the default JVM trust manager.keyManager- The key manager to use for secure connection. Can benullto use the default JVM key manager.providerClassLoader- TheClassLoaderused to fetch theTransportProvider. This can be useful in OSGI environments.- Returns:
- A new connection factory using the provided JSON configuration.
- Throws:
IllegalArgumentException- If the configuration is invalid.
-
configureConnectionFactory
public static org.forgerock.opendj.ldap.ConnectionFactory configureConnectionFactory(org.forgerock.json.JsonValue configuration, String name, TrustManager trustManager, X509KeyManager keyManager) Creates a new connection factory using the named configuration in the provided JSON list of factory configurations. See the sample configuration file for a detailed description of its content.- Parameters:
configuration- The JSON configuration.name- The name of the connection factory configuration to be parsed.trustManager- The trust manager to use for secure connection. Can benullto use the default JVM trust manager.keyManager- The key manager to use for secure connection. Can benullto use the default JVM key manager.- Returns:
- A new connection factory using the provided JSON configuration.
- Throws:
IllegalArgumentException- If the configuration is invalid.
-