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

Matthew Swift
22.13.2013 b231195429e28098e1baceda8a2a2f553a58ca33
Minor improvement for OPENDJ-419: exposing SIMPLE and SASL authentication types in BindRequest.
4 files modified
30 ■■■■ changed files
opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java 4 ●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPServerFilter.java 4 ●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java 2 ●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java 20 ●●●● patch | view | raw | blame | history
opendj3/opendj-ldap-sdk-examples/src/main/java/org/forgerock/opendj/examples/Proxy.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009-2010 Sun Microsystems, Inc.
 *      Portions copyright 2011-2012 ForgeRock AS
 *      Portions copyright 2011-2013 ForgeRock AS
 */
package org.forgerock.opendj.examples;
@@ -208,7 +208,7 @@
                final IntermediateResponseHandler intermediateResponseHandler,
                final ResultHandler<? super BindResult> resultHandler) {
            if (request.getAuthenticationType() != ((byte) 0x80)) {
            if (request.getAuthenticationType() != BindRequest.AUTHENTICATION_TYPE_SIMPLE) {
                // TODO: SASL authentication not implemented.
                resultHandler.handleErrorResult(newErrorResult(ResultCode.PROTOCOL_ERROR,
                        "non-SIMPLE authentication not supported: "
opendj3/opendj-ldap-sdk/src/main/java/com/forgerock/opendj/ldap/LDAPServerFilter.java
@@ -688,14 +688,14 @@
                @Override
                public void bindRequest(final FilterChainContext ctx, final int messageID,
                        final int version, final GenericBindRequest bindContext)
                        final int version, final GenericBindRequest request)
                        throws UnexpectedRequestException {
                    final ClientContextImpl clientContext =
                            LDAP_CONNECTION_ATTR.get(ctx.getConnection());
                    if (clientContext != null) {
                        final ServerConnection<Integer> conn = clientContext.getServerConnection();
                        final BindHandler handler = new BindHandler(clientContext, messageID);
                        conn.handleBind(messageID, version, bindContext, handler, handler);
                        conn.handleBind(messageID, version, request, handler, handler);
                    }
                }
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/MemoryBackend.java
@@ -196,7 +196,7 @@
                if (request instanceof SimpleBindRequest) {
                    password = ((SimpleBindRequest) request).getPassword();
                } else if (request instanceof GenericBindRequest
                        && request.getAuthenticationType() == ((byte) 0x80)) {
                        && request.getAuthenticationType() == BindRequest.AUTHENTICATION_TYPE_SIMPLE) {
                    password = ((GenericBindRequest) request).getAuthenticationValue();
                } else {
                    throw newErrorResult(ResultCode.PROTOCOL_ERROR,
opendj3/opendj-ldap-sdk/src/main/java/org/forgerock/opendj/ldap/requests/BindRequest.java
@@ -22,7 +22,7 @@
 *
 *
 *      Copyright 2009 Sun Microsystems, Inc.
 *      Portions copyright 2012 ForgeRock AS.
 *      Portions copyright 2012-2013 ForgeRock AS.
 */
package org.forgerock.opendj.ldap.requests;
@@ -42,6 +42,17 @@
 */
public interface BindRequest extends Request {
    /**
     * The authentication type value (0x80) reserved for simple authentication.
     */
    public static final byte AUTHENTICATION_TYPE_SIMPLE = (byte) 0x80;
    /**
     * The authentication type value (0xA3) reserved for SASL authentication.
     */
    public static final byte AUTHENTICATION_TYPE_SASL = (byte) 0xA3;
    @Override
    BindRequest addControl(Control control);
@@ -61,9 +72,10 @@
    /**
     * Returns the authentication mechanism identifier for this generic bind
     * request as defined by the LDAP protocol. Note that value {@code 0x80} is
     * reserved for simple authentication and {@code 0xA3} is reserved for SASL
     * authentication.
     * request as defined by the LDAP protocol. Note that the value
     * {@link #AUTHENTICATION_TYPE_SIMPLE} ({@code 0x80}) is reserved for simple
     * authentication and the value {@link #AUTHENTICATION_TYPE_SASL} (
     * {@code 0xA3}) is reserved for SASL authentication.
     *
     * @return The authentication mechanism identifier.
     */