directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ckopp...@apache.org
Subject svn commit: r581735 - in /directory/studio/trunk: studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ studio-connection-ui/src/main/...
Date Wed, 03 Oct 2007 21:50:57 GMT
Author: ckoppelt
Date: Wed Oct  3 14:50:56 2007
New Revision: 581735

URL: http://svn.apache.org/viewvc?rev=581735&view=rev
Log:
DIGEST-MD5 Realm added

Modified:
    directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
    directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
    directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
    directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java

Modified: directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
(original)
+++ directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/Connection.java
Wed Oct  3 14:50:56 2007
@@ -59,7 +59,7 @@
     public Object clone()
     {
         ConnectionParameter cp = new ConnectionParameter( getName(), getHost(), getPort(),
getEncryptionMethod(),
-            getAuthMethod(), getBindPrincipal(), getBindPassword(), getConnectionParameter().getExtendedProperties()
);
+            getAuthMethod(), getBindPrincipal(), getBindPassword(), getSaslRealm(), getConnectionParameter().getExtendedProperties()
);
 
         Connection clone = new Connection( cp );
 
@@ -192,6 +192,11 @@
         return connectionParameter.getPort();
     }
 
+    
+    public String getSaslRealm ()
+    {
+    	return connectionParameter.getSaslRealm();
+    }
 
     /**
      * Sets the auth method.
@@ -274,6 +279,13 @@
     {
         connectionParameter.setPort( port );
         ConnectionEventRegistry.fireConnectionUpdated( this, this );
+    }
+    
+    
+    public void setSaslRealm (String realm)
+    {
+    	connectionParameter.setSaslRealm(realm);
+    	ConnectionEventRegistry.fireConnectionUpdated(this, this);
     }
     
     

Modified: directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
(original)
+++ directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionParameter.java
Wed Oct  3 14:50:56 2007
@@ -104,6 +104,9 @@
 
     /** The bind password. */
     private String bindPassword;
+    
+    /** The SASL realm **/
+    private String saslRealm;
 
     /** The extended properties. */
     private Map<String, String> extendedProperties;
@@ -132,7 +135,7 @@
      * @param extendedProperties the extended properties
      */
     public ConnectionParameter( String name, String host, int port, EncryptionMethod encryptionMethod,
-        AuthenticationMethod authMethod, String bindPrincipal, String bindPassword,
+        AuthenticationMethod authMethod, String bindPrincipal, String bindPassword, String
saslRealm,
         Map<String, String> extendedProperties )
     {
         this.id = createId();
@@ -143,6 +146,7 @@
         this.authMethod = authMethod;
         this.bindPrincipal = bindPrincipal;
         this.bindPassword = bindPassword;
+        this.saslRealm = saslRealm;
         this.extendedProperties = new HashMap<String, String>();
         if ( extendedProperties != null )
         {
@@ -192,6 +196,24 @@
     public void setBindPassword( String bindPassword )
     {
         this.bindPassword = bindPassword;
+    }
+    
+    
+    /**
+     * Gets the SASL realm
+     * @return the sasl realm
+     */
+    public String getSaslRealm (){
+    	return saslRealm;
+    }
+    
+    
+    /**
+     * Sets the SASL realm
+     * @param saslRealm the sasl realm
+     */
+    public void setSaslRealm (String saslRealm){
+    	this.saslRealm = saslRealm;
     }
 
 

Modified: directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
(original)
+++ directory/studio/trunk/studio-connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/JNDIConnectionWrapper.java
Wed Oct  3 14:50:56 2007
@@ -75,6 +75,8 @@
     private String bindPrincipal;
 
     private String bindCredentials;
+    
+    private String saslRealm;
 
     private Hashtable<String, String> environment;
 
@@ -681,11 +683,16 @@
             else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_DIGEST_MD5
)
             {
                 authMethod = "DIGEST-MD5";
+                saslRealm = connection.getConnectionParameter().getSaslRealm();
             }
             else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_CRAM_MD5
)
             {
                 authMethod = "CRAM-MD5";
             }
+            else if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_GSSAPI
)
+            {
+                authMethod = "GSSAPI";
+            }
 
             // setup credentials
             IAuthHandler authHandler = ConnectionCorePlugin.getDefault().getAuthHandler();
@@ -713,11 +720,16 @@
                         context.removeFromEnvironment( Context.SECURITY_AUTHENTICATION );
                         context.removeFromEnvironment( Context.SECURITY_PRINCIPAL );
                         context.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
+                        context.removeFromEnvironment( "java.naming.security.sasl.realm"
);
 
                         context.addToEnvironment( Context.SECURITY_PRINCIPAL, bindPrincipal
);
                         context.addToEnvironment( Context.SECURITY_CREDENTIALS, bindCredentials
);
                         context.addToEnvironment( Context.SECURITY_AUTHENTICATION, authMethod
);
 
+                        if ( connection.getConnectionParameter().getAuthMethod() == ConnectionParameter.AuthenticationMethod.SASL_DIGEST_MD5
)
+                        {
+                            context.addToEnvironment( "java.naming.security.sasl.realm",
saslRealm );
+                        }
                         context.reconnect( context.getConnectControls() );
                     }
                     catch ( NamingException ne )

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/AbstractConnectionParameterPage.java
Wed Oct  3 14:50:56 2007
@@ -56,6 +56,8 @@
 
     /** The error message. */
     protected String errorMessage;
+    
+    protected String infoMessage;
 
     /** The connection parameter. */
     protected ConnectionParameter connectionParameter;
@@ -196,5 +198,10 @@
     {
         return message == null && errorMessage == null;
     }
+
+
+	public String getInfoMessage() {
+		return infoMessage;
+	}
 
 }

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionParameterPage.java
Wed Oct  3 14:50:56 2007
@@ -78,6 +78,8 @@
      */
     public String getMessage();
 
+    
+    public String getInfoMessage();
 
     /**
      * Creates the composite.

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/ConnectionUIConstants.java
Wed Oct  3 14:50:56 2007
@@ -28,6 +28,8 @@
     public static final String DIALOGSETTING_KEY_PORT_HISTORY = "portHistory";
     
     public static final String DIALOGSETTING_KEY_PRINCIPAL_HISTORY = "principalHistory";
+    
+    public static final String DIALOGSETTING_KEY_REALM_HISTORY = "saslrealmHistory";
 
     
     public static final String IMG_CONNECTION_ADD = "resources/icons/connection_add.gif";

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/AuthenticationParameterPage.java
Wed Oct  3 14:50:56 2007
@@ -60,6 +60,9 @@
 
     /** The text widget to input bind password */
     private Text bindPasswordText;
+    
+    /** The text widget to input saslRealm */
+    private Combo saslRealmText;
 
     /** The checkbox to choose if the bind password should be saved on disk */
     private Button saveBindPasswordButton;
@@ -91,6 +94,8 @@
                 return ConnectionParameter.AuthenticationMethod.SASL_DIGEST_MD5;
             case 3:
                 return ConnectionParameter.AuthenticationMethod.SASL_CRAM_MD5;
+            case 4:
+                return ConnectionParameter.AuthenticationMethod.SASL_GSSAPI;
             default:
                 return ConnectionParameter.AuthenticationMethod.NONE;
         }
@@ -117,6 +122,11 @@
     {
         return isSaveBindPassword() ? bindPasswordText.getText() : null;
     }
+    
+    private String getSaslRealm()
+    {
+        return saslRealmText.getText();
+    }
 
 
     /**
@@ -191,6 +201,17 @@
             }
         } );
 
+        BaseWidgetUtils.createLabel( composite, "SASL Realm:", 1 );
+        String[] saslHistory = HistoryUtils.load( ConnectionUIConstants.DIALOGSETTING_KEY_REALM_HISTORY
);
+        saslRealmText = BaseWidgetUtils.createCombo( composite, saslHistory, -1, 2 );
+        saslRealmText.addModifyListener( new ModifyListener()
+        {
+            public void modifyText( ModifyEvent even )
+            {
+                connectionPageModified();
+            }
+        } );
+        
         BaseWidgetUtils.createSpacer( composite, 1 );
         saveBindPasswordButton = BaseWidgetUtils.createCheckbox( composite, "Save password",
1 );
         saveBindPasswordButton.setSelection( true );
@@ -222,7 +243,7 @@
                 }
             }
         } );
-
+        
         validate();
     }
 
@@ -232,6 +253,7 @@
      */
     private void connectionPageModified()
     {
+    	
         validate();
         fireConnectionPageModified();
     }
@@ -248,6 +270,7 @@
         saveBindPasswordButton.setEnabled( isPrincipalPasswordEnabled() );
         checkPrincipalPasswordAuthButton.setEnabled( isPrincipalPasswordEnabled() &&
isSaveBindPassword()
             && !bindPrincipalCombo.getText().equals( "" ) && !bindPasswordText.getText().equals(
"" ) );
+        saslRealmText.setEnabled( isSaslRealmTextEnabled() );
 
         // validate input fields
         message = null;
@@ -263,6 +286,15 @@
                 message = "Please enter a bind DN or user.";
             }
         }
+        
+        if ( isSaslRealmTextEnabled() )
+        {
+            if ( "".equals( saslRealmText.getText() ) )
+            {
+                message = message != null ? message + "\n" : "";
+                message += "Please enter a SASL Realm otherwise any available SASL realm
is chosen";
+            }
+        }
     }
 
 
@@ -277,6 +309,16 @@
             || ( getAuthenticationMethod() == AuthenticationMethod.SASL_DIGEST_MD5 )
             || ( getAuthenticationMethod() == AuthenticationMethod.SASL_CRAM_MD5 );
     }
+    
+    
+    private boolean isSaslRealmTextEnabled(){
+    	return getAuthenticationMethod() == AuthenticationMethod.SASL_DIGEST_MD5;
+    }
+    
+    
+    private boolean isGssapiEnabled(){
+    	return getAuthenticationMethod() == AuthenticationMethod.SASL_GSSAPI;
+    }
 
 
     /**
@@ -288,11 +330,13 @@
 
         int index = parameter.getAuthMethod() == AuthenticationMethod.SIMPLE ? 1
             : parameter.getAuthMethod() == AuthenticationMethod.SASL_DIGEST_MD5 ? 2
-                : parameter.getAuthMethod() == AuthenticationMethod.SASL_CRAM_MD5 ? 3 : 0;
+                : parameter.getAuthMethod() == AuthenticationMethod.SASL_CRAM_MD5 ? 3
+                    : parameter.getAuthMethod() == AuthenticationMethod.SASL_GSSAPI ? 4 :
0;
         authenticationMethodCombo.select( index );
         bindPrincipalCombo.setText( parameter.getBindPrincipal() );
         bindPasswordText.setText( parameter.getBindPassword() != null ? parameter.getBindPassword()
: "" );
         saveBindPasswordButton.setSelection( parameter.getBindPassword() != null );
+        saslRealmText.setText( parameter.getSaslRealm() != null ? parameter.getSaslRealm()
: "" );
 
         connectionPageModified();
     }
@@ -306,6 +350,7 @@
         parameter.setAuthMethod( getAuthenticationMethod() );
         parameter.setBindPrincipal( getBindPrincipal() );
         parameter.setBindPassword( getBindPassword() );
+        parameter.setSaslRealm(getSaslRealm());
     }
 
 
@@ -315,6 +360,10 @@
     public void saveDialogSettings()
     {
         HistoryUtils.save( ConnectionUIConstants.DIALOGSETTING_KEY_PRINCIPAL_HISTORY, bindPrincipalCombo.getText()
);
+        if ( getAuthenticationMethod().equals( AuthenticationMethod.SASL_DIGEST_MD5 ) )
+        {
+            HistoryUtils.save( ConnectionUIConstants.DIALOGSETTING_KEY_REALM_HISTORY, saslRealmText.getText()
);
+        }
     }
 
 
@@ -341,9 +390,11 @@
      */
     public boolean isReconnectionRequired()
     {
-        return connectionParameter == null || connectionParameter.getAuthMethod() != getAuthenticationMethod()
+        return connectionParameter == null
+            || connectionParameter.getAuthMethod() != getAuthenticationMethod()
             || !( connectionParameter.getBindPrincipal().equals( getBindPrincipal() ) )
-            || !( connectionParameter.getBindPassword().equals( getBindPassword() ) );
+            || !( connectionParameter.getBindPassword().equals( getBindPassword() ) || !(
connectionParameter
+                .getSaslRealm().equals( getSaslRealm() ) ) );
     }
 
 }

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/widgets/NetworkParameterPage.java
Wed Oct  3 14:50:56 2007
@@ -140,7 +140,7 @@
     private Connection getTestConnection()
     {
         ConnectionParameter cp = new ConnectionParameter( null, getHostName(), getPort(),
getEncyrptionMethod(),
-            ConnectionParameter.AuthenticationMethod.NONE, null, null, null );
+            ConnectionParameter.AuthenticationMethod.NONE, null, null, null, null );
         Connection conn = new Connection( cp );
         return conn;
     }

Modified: directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java?rev=581735&r1=581734&r2=581735&view=diff
==============================================================================
--- directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
(original)
+++ directory/studio/trunk/studio-connection-ui/src/main/java/org/apache/directory/studio/connection/ui/wizards/NewConnectionWizardPage.java
Wed Oct  3 14:50:56 2007
@@ -103,7 +103,21 @@
      */
     public void connectionParameterPageModified()
     {
-        setMessage( page.getMessage() );
+    	//only one of the messages can be shown
+    	//warning messages are more important 
+    	//than info messages
+    	if ( page.getMessage() != null )
+        {
+            setMessage( page.getMessage() );
+        }
+        else if ( page.getInfoMessage() != null )
+        {
+            setMessage( page.getInfoMessage() );
+        }
+        else
+        {
+            setMessage( null );
+        }
         setErrorMessage( page.getErrorMessage() );
         setPageComplete( page.isValid() );
         getContainer().updateButtons();



Mime
View raw message