mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Matthew Swift
21.42.2013 bd58756e64a0330feb547c2ffd7de716471d98e8
opendj3/opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Config.java
@@ -15,6 +15,7 @@
 */
package org.forgerock.opendj.rest2ldap;
import org.forgerock.opendj.ldap.ConnectionFactory;
import org.forgerock.opendj.ldap.DecodeOptions;
import org.forgerock.opendj.ldap.schema.Schema;
@@ -22,35 +23,63 @@
 * Common configuration options.
 */
final class Config {
    private final ConnectionFactory factory;
    private final DecodeOptions options;
    private final AuthzIdTemplate proxiedAuthzTemplate;
    private final ReadOnUpdatePolicy readOnUpdatePolicy;
    private final Schema schema;
    Config(final ReadOnUpdatePolicy readOnUpdatePolicy, final Schema schema) {
    Config(final ConnectionFactory factory, final ReadOnUpdatePolicy readOnUpdatePolicy,
            final AuthzIdTemplate proxiedAuthzTemplate, final Schema schema) {
        this.factory = factory;
        this.readOnUpdatePolicy = readOnUpdatePolicy;
        this.proxiedAuthzTemplate = proxiedAuthzTemplate;
        this.schema = schema;
        this.options = new DecodeOptions().setSchema(schema);
    }
    /**
     * Returns the LDAP SDK connection factory which should be used when
     * performing LDAP operations.
     *
     * @return The LDAP SDK connection factory which should be used when
     *         performing LDAP operations.
     */
    ConnectionFactory connectionFactory() {
        return factory;
    }
    /**
     * Returns the decoding options which should be used when decoding controls
     * in responses.
     *
     * @return The decoding options which should be used when decoding controls
     *         in responses.
     */
    public DecodeOptions decodeOptions() {
    DecodeOptions decodeOptions() {
        return options;
    }
    /**
     * Returns the authorization ID template which should be used when proxied
     * authorization is enabled.
     *
     * @return The authorization ID template which should be used when proxied
     *         authorization is enabled, or {@code null} if proxied
     *         authorization is disabled.
     */
    AuthzIdTemplate getProxiedAuthorizationTemplate() {
        return proxiedAuthzTemplate;
    }
    /**
     * Returns the policy which should be used in order to read an entry before
     * it is deleted, or after it is added or modified.
     *
     * @return The policy which should be used in order to read an entry before
     *         it is deleted, or after it is added or modified.
     */
    public ReadOnUpdatePolicy readOnUpdatePolicy() {
    ReadOnUpdatePolicy readOnUpdatePolicy() {
        return readOnUpdatePolicy;
    }
@@ -61,7 +90,18 @@
     * @return The schema which should be used when attribute types and
     *         controls.
     */
    public Schema schema() {
    Schema schema() {
        return schema;
    }
    /**
     * Returns {@code true} if the proxied authorization should be used for
     * authorizing LDAP requests.
     *
     * @return {@code true} if the proxied authorization should be used for
     *         authorizing LDAP requests.
     */
    boolean useProxiedAuthorization() {
        return proxiedAuthzTemplate != null;
    }
}