You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2006/09/04 00:28:45 UTC

svn commit: r439852 - /directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/bind/BindResponse.java

Author: elecharny
Date: Sun Sep  3 15:28:45 2006
New Revision: 439852

URL: http://svn.apache.org/viewvc?view=rev&rev=439852
Log:
Added the implementation of the BindResponse class

Added:
    directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/bind/BindResponse.java

Added: directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/bind/BindResponse.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/bind/BindResponse.java?view=auto&rev=439852
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/bind/BindResponse.java (added)
+++ directory/sandbox/akarasulu/apacheds-2.0/shared/ldap/src/main/java/org/apache/directory/shared/ldap/messages/bind/BindResponse.java Sun Sep  3 15:28:45 2006
@@ -0,0 +1,107 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.shared.ldap.messages.bind;
+
+import org.apache.directory.shared.ldap.messages.AbstractResultResponse;
+import org.apache.directory.shared.ldap.utils.StringTools;
+
+/**
+ * A BindResponse Message. Its syntax is : 
+ * 
+ * BindResponse ::= [APPLICATION 1] SEQUENCE { 
+ *     COMPONENTS OF LDAPResult, 
+ *     serverSaslCreds [7] OCTET STRING OPTIONAL 
+ * } 
+ * 
+ * LdapResult ::= resultCode matchedDN errorMessage (referrals)*
+ * 
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class BindResponse extends AbstractResultResponse
+{
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
+    static final long serialVersionUID = 2L;
+    
+    /** optional property holding SASL authentication response paramters */
+    private byte[] serverSaslCreds;
+
+    /**
+     * Creates a BindResponse as a reply to an BindRequest.
+     * 
+     * @param id
+     *            the session unique message id
+     */
+    public BindResponse( int messageId)
+    {
+        super( messageId );
+    }
+    
+    /**
+     * Gets the optional property holding SASL authentication response paramters
+     * that are SASL mechanism specific. Will return null if the authentication
+     * is simple.
+     * 
+     * @return the sasl mech. specific credentials or null of auth. is simple
+     */
+    public byte[] getServerSaslCreds()
+    {
+        return serverSaslCreds;
+    }
+
+
+    /**
+     * Sets the optional property holding SASL authentication response paramters
+     * that are SASL mechanism specific. Leave null if authentication mode is
+     * simple.
+     * 
+     * @param serverSaslCreds the sasl auth. mech. specific credentials
+     */
+    public void setServerSaslCreds( byte[] serverSaslCreds )
+    {
+        this.serverSaslCreds = serverSaslCreds;
+    }
+
+    /**
+     * Get a String representation of a BindResponse
+     * 
+     * @return A BindResponse String
+     */
+    public String toString()
+    {
+        StringBuffer sb = new StringBuffer();
+
+        sb.append( "    BindResponse\n" );
+        sb.append( super.toString() );
+
+        if ( serverSaslCreds != null )
+        {
+            sb.append( "        Server sasl credentials : '" ).
+            append( StringTools.dumpBytes( serverSaslCreds ) ).append( "'\n" );
+        }
+
+        return sb.toString();
+    }
+}