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

Gaetan Boismal
06.18.2016 79811e7a2c59f9e4b237043466b736b5ece294dc
opendj-rest2ldap/src/main/java/org/forgerock/opendj/rest2ldap/Rest2LDAPHttpApplication.java
@@ -387,14 +387,14 @@
    private AuthenticationStrategy buildSimpleBindStrategy(final JsonValue config) {
        return newSimpleBindStrategy(getConnectionFactory(config.get("ldapConnectionFactory")
                                                                .defaultTo(DEFAULT_BIND_FACTORY).asString()),
                                     config.get("bindDNTemplate").defaultTo("%s").asString(),
                                     parseUserNameTemplate(config.get("bindDNTemplate").defaultTo("%s")),
                                     schema);
    }
    private AuthenticationStrategy buildSASLBindStrategy(JsonValue config) {
        return newSASLPlainStrategy(
                getConnectionFactory(config.get("ldapConnectionFactory").defaultTo(DEFAULT_BIND_FACTORY).asString()),
                schema, config.get(AUTHZID_TEMPLATE).defaultTo("u:%s").asString());
                schema, parseUserNameTemplate(config.get(AUTHZID_TEMPLATE).defaultTo("u:%s")));
    }
    private AuthenticationStrategy buildSearchThenBindStrategy(JsonValue config) {
@@ -405,6 +405,10 @@
                        config.get("bindLDAPConnectionFactory").defaultTo(DEFAULT_BIND_FACTORY).asString()),
                DN.valueOf(config.get("baseDN").required().asString(), schema),
                SearchScope.valueOf(config.get("scope").required().asString().toLowerCase()),
                config.get("filterTemplate").required().asString());
                parseUserNameTemplate(config.get("filterTemplate").required()));
    }
    private String parseUserNameTemplate(final JsonValue template) {
        return template.asString().replace("{username}", "%s");
    }
}