directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckopp...@apache.org
Subject svn commit: r560549 - in /directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core: internal/model/ model/
Date Sat, 28 Jul 2007 14:01:09 GMT
Author: ckoppelt
Date: Sat Jul 28 07:01:08 2007
New Revision: 560549

URL: http://svn.apache.org/viewvc?view=rev&rev=560549
Log:
start implementing SASL authentication

Modified:
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionContext.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ConnectionParameter.java
    directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IConnection.java

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java?view=diff&rev=560549&r1=560548&r2=560549
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/Connection.java
Sat Jul 28 07:01:08 2007
@@ -795,6 +795,18 @@
         EventRegistry.fireConnectionUpdated( new ConnectionUpdateEvent( this,
             ConnectionUpdateEvent.EventDetail.CONNECTION_PARAMETER_UPDATED ), this );
     }
+    
+    public int getSASLMechanism ()
+    {
+    	return this.connectionParameter.getSaslMechanism();
+    }
+    
+    public void setSASLMechanism (int saslMethod)
+    {
+    	this.connectionParameter.setSaslMechanism(saslMethod);
+    	EventRegistry.fireConnectionUpdated(new ConnectionUpdateEvent (this,
+    			ConnectionUpdateEvent.EventDetail.CONNECTION_PARAMETER_UPDATED), this);
+    }
 
 
     public int getTimeLimit()

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionContext.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionContext.java?view=diff&rev=560549&r1=560548&r2=560549
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionContext.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionContext.java
Sat Jul 28 07:01:08 2007
@@ -122,25 +122,33 @@
 
     public void bindAnonymous( ExtendedProgressMonitor monitor ) throws NamingException
     {
-        this.authMethod = "none"; //$NON-NLS-1$
-        this.principal = ""; //$NON-NLS-1$
-        this.credentials = ""; //$NON-NLS-1$
-
-        try
-        {
-            this.doBind( monitor );
-        }
-        catch ( NamingException ne )
-        {
-            this.close();
-            throw ne;
-        }
+        bindWithAuth( "", "", "none", monitor );
     }
 
 
     public void bindSimple( String user, String password, ExtendedProgressMonitor monitor
) throws NamingException
     {
-        this.authMethod = "simple"; //$NON-NLS-1$
+        bindWithAuth( user, password, "simple", monitor );
+    }
+
+
+    public void bindSaslDigestMD5( String user, String password, ExtendedProgressMonitor
monitor )
+        throws NamingException
+    {
+        bindWithAuth( user, password, "DIGEST-MD5", monitor );
+    }
+    
+    
+    public void bindSaslCramMD5( String user, String password, ExtendedProgressMonitor monitor
) throws NamingException
+    {
+        bindWithAuth( user, password, "CRAM-MD5", monitor );
+    }
+
+
+    private void bindWithAuth( String user, String password, String authMethod, ExtendedProgressMonitor
monitor )
+        throws NamingException
+    {
+        this.authMethod = authMethod;
         this.principal = user;
         this.credentials = password;
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java?view=diff&rev=560549&r1=560548&r2=560549
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/internal/model/JNDIConnectionProvider.java
Sat Jul 28 07:01:08 2007
@@ -107,6 +107,21 @@
                 String bindPassword = credentials.getBindPassword();
                 this.context.bindSimple( bindPrincipal, bindPassword, monitor );
             }
+            
+            else if (parameter.getAuthMethod() == IConnection.AUTH_SASL_DIGMD5)
+            {
+            	String bindPrincipal = credentials.getBindPrincipal();
+                String bindPassword = credentials.getBindPassword();
+                this.context.bindSaslDigestMD5(bindPrincipal, bindPassword, monitor);
+            }
+            
+            else if (parameter.getAuthMethod() == IConnection.AUTH_SASL_CRAMD5)
+            {
+            	String bindPrincipal = credentials.getBindPrincipal();
+                String bindPassword = credentials.getBindPassword();
+                this.context.bindSaslCramMD5(bindPrincipal, bindPassword, monitor);
+            }
+            
             else if ( parameter.getAuthMethod() == IConnection.AUTH_ANONYMOUS )
             {
                 this.context.bindAnonymous( monitor );

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ConnectionParameter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ConnectionParameter.java?view=diff&rev=560549&r1=560548&r2=560549
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ConnectionParameter.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/ConnectionParameter.java
Sat Jul 28 07:01:08 2007
@@ -45,6 +45,9 @@
 
     /** The encryption method, one of IConnection.ENCYRPTION_NONE, IConnection.ENCYRPTION_LDAPS
or IConnection.ENCYRPTION_STARTTLS. */
     private int encryptionMethod;
+    
+    /** The sasl mechanism, one of IConnection.AUTH_SASL_DIGMD5, IConnection.AUTH_SASL_CRAMD5
*/
+    private int saslMechanism;
 
     /** The port of the LDAP server. */
     private int port;
@@ -370,6 +373,16 @@
     public void setEncryptionMethod( int encryptionMethod )
     {
         this.encryptionMethod = encryptionMethod;
+    }
+    
+    
+    public int getSaslMechanism(){
+    	return this.saslMechanism;
+    }
+    
+    
+    public void setSaslMechanism(int saslMechanism){
+    	this.saslMechanism = saslMechanism;    	
     }
 
 

Modified: directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IConnection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IConnection.java?view=diff&rev=560549&r1=560548&r2=560549
==============================================================================
--- directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IConnection.java
(original)
+++ directory/studio/trunk/studio-ldapbrowser-core/src/main/java/org/apache/directory/studio/ldapbrowser/core/model/IConnection.java
Sat Jul 28 07:01:08 2007
@@ -49,6 +49,10 @@
     public static final int AUTH_ANONYMOUS = 0;
 
     public static final int AUTH_SIMPLE = 1;
+    
+    public static final int AUTH_SASL_DIGMD5 = 2;
+    
+    public static final int AUTH_SASL_CRAMD5 = 3;
 
     public static final int ENCYRPTION_NONE = 0;
 



Mime
View raw message