directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1092705 - /directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Date Fri, 15 Apr 2011 13:46:05 GMT
Author: pamarcelot
Date: Fri Apr 15 13:46:04 2011
New Revision: 1092705

URL: http://svn.apache.org/viewvc?rev=1092705&view=rev
Log:
Redo for commit '1072035' which was lost after an errorneous merge at commit '1072793' 

Initial commit log was:
Fix for DIRAPI-42 (Add additional classes and clean method arguments for SASL binds (CRAM-MD5,
DIGEST-MD5, GSS-API)).
Added support for the 'PREFERENCE_USE_KRB5_SYSTEM_PROPERTIES' pref property when connecting
via GSSAPI.

Modified:
    directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java

Modified: directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java?rev=1092705&r1=1092704&r2=1092705&view=diff
==============================================================================
--- directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
(original)
+++ directory/studio/trunk/plugins/connection.core/src/main/java/org/apache/directory/studio/connection/core/io/api/DirectoryApiConnectionWrapper.java
Fri Apr 15 13:46:04 2011
@@ -78,6 +78,7 @@ import org.apache.directory.studio.commo
 import org.apache.directory.studio.connection.core.Connection;
 import org.apache.directory.studio.connection.core.Connection.AliasDereferencingMethod;
 import org.apache.directory.studio.connection.core.Connection.ReferralHandlingMethod;
+import org.apache.directory.studio.connection.core.ConnectionCoreConstants;
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.connection.core.ConnectionParameter;
 import org.apache.directory.studio.connection.core.ConnectionParameter.EncryptionMethod;
@@ -90,6 +91,7 @@ import org.apache.directory.studio.conne
 import org.apache.directory.studio.connection.core.io.StudioTrustManager;
 import org.apache.directory.studio.connection.core.io.jndi.CancelException;
 import org.apache.directory.studio.connection.core.io.jndi.ReferralsInfo;
+import org.eclipse.core.runtime.Preferences;
 import org.eclipse.osgi.util.NLS;
 
 
@@ -352,6 +354,11 @@ public class DirectoryApiConnectionWrapp
                             CramMd5Request cramMd5Request = new CramMd5Request();
                             cramMd5Request.setUsername( bindPrincipal );
                             cramMd5Request.setCredentials( bindPassword );
+                            cramMd5Request.setQualityOfProtection( connection.getConnectionParameter().getSaslQop()
);
+                            cramMd5Request.setSecurityStrength( connection.getConnectionParameter()
+                                .getSaslSecurityStrength() );
+                            cramMd5Request.setMutualAuthentication( connection.getConnectionParameter()
+                                .isSaslMutualAuthentication() );
 
                             bindResponse = ldapConnection.bind( cramMd5Request );
                         }
@@ -362,6 +369,11 @@ public class DirectoryApiConnectionWrapp
                             digestMd5Request.setUsername( bindPrincipal );
                             digestMd5Request.setCredentials( bindPassword );
                             digestMd5Request.setRealmName( connection.getConnectionParameter().getSaslRealm()
);
+                            digestMd5Request.setQualityOfProtection( connection.getConnectionParameter().getSaslQop()
);
+                            digestMd5Request.setSecurityStrength( connection.getConnectionParameter()
+                                .getSaslSecurityStrength() );
+                            digestMd5Request.setMutualAuthentication( connection.getConnectionParameter()
+                                .isSaslMutualAuthentication() );
 
                             bindResponse = ldapConnection.bind( digestMd5Request );
                         }
@@ -369,11 +381,42 @@ public class DirectoryApiConnectionWrapp
                         else if ( connection.getConnectionParameter().getAuthMethod() ==
ConnectionParameter.AuthenticationMethod.SASL_GSSAPI )
                         {
                             GssApiRequest gssApiRequest = new GssApiRequest();
-                            gssApiRequest.setUsername( bindPrincipal );
-                            gssApiRequest.setCredentials( bindPassword );
-                            gssApiRequest.setRealmName( connection.getConnectionParameter().getKrb5Realm()
);
-                            gssApiRequest.setKdcHost( connection.getConnectionParameter().getKrb5KdcHost()
);
-                            gssApiRequest.setKdcPort( connection.getConnectionParameter().getKrb5KdcPort()
);
+
+                            Preferences preferences = ConnectionCorePlugin.getDefault().getPluginPreferences();
+                            boolean useKrb5SystemProperties = preferences
+                                .getBoolean( ConnectionCoreConstants.PREFERENCE_USE_KRB5_SYSTEM_PROPERTIES
);
+                            String krb5LoginModule = preferences
+                                .getString( ConnectionCoreConstants.PREFERENCE_KRB5_LOGIN_MODULE
);
+
+                            if ( !useKrb5SystemProperties )
+                            {
+                                gssApiRequest.setUsername( bindPrincipal );
+                                gssApiRequest.setCredentials( bindPassword );
+                                gssApiRequest.setQualityOfProtection( connection
+                                                                .getConnectionParameter().getSaslQop()
);
+                                gssApiRequest.setSecurityStrength( connection
+                                                                .getConnectionParameter()
+                                                                .getSaslSecurityStrength()
);
+                                gssApiRequest.setMutualAuthentication( connection
+                                                                .getConnectionParameter()
+                                                                .isSaslMutualAuthentication()
);
+                                gssApiRequest
+                                                                .setLoginModuleConfiguration(
new InnerConfiguration(
+                                                                    krb5LoginModule ) );
+
+                                switch ( connection.getConnectionParameter().getKrb5Configuration()
)
+                                {
+                                    case FILE:
+                                        gssApiRequest.setKrb5ConfFilePath( connection.getConnectionParameter()
+                                            .getKrb5ConfigurationFile() );
+                                        break;
+                                    case MANUAL:
+                                        gssApiRequest.setRealmName( connection.getConnectionParameter().getKrb5Realm()
);
+                                        gssApiRequest.setKdcHost( connection.getConnectionParameter().getKrb5KdcHost()
);
+                                        gssApiRequest.setKdcPort( connection.getConnectionParameter().getKrb5KdcPort()
);
+                                        break;
+                                }
+                            }
 
                             bindResponse = ldapConnection.bind( gssApiRequest );
                         }



Mime
View raw message