jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1509855 - /jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/KerberosManager.java
Date Fri, 02 Aug 2013 20:51:09 GMT
Author: pmouawad
Date: Fri Aug  2 20:51:09 2013
New Revision: 1509855

URL: http://svn.apache.org/r1509855
Log:
Bug 53480 - Add Kerberos support to Http Sampler (HttpClient4)
Make jaas application configuration and default to JMeter
Bugzilla Id: 53480

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/KerberosManager.java

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/KerberosManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/KerberosManager.java?rev=1509855&r1=1509854&r2=1509855&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/KerberosManager.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/KerberosManager.java
Fri Aug  2 20:51:09 2013
@@ -36,6 +36,7 @@ import javax.security.auth.callback.Unsu
 import javax.security.auth.login.LoginContext;
 import javax.security.auth.login.LoginException;
 
+import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
@@ -49,6 +50,7 @@ class KerberosManager implements Seriali
 
     private static final Logger log = LoggingManager.getLoggerForClass();
 
+    private static final String JAAS_APPLICATION = JMeterUtils.getPropDefault("kerberos_jaas_application",
"JMeter"); //$NON-NLS-1$ $NON-NLS-2$
     private ConcurrentMap<String, Future<Subject>> subjects
         = new ConcurrentHashMap<String, Future<Subject>>();
 
@@ -67,7 +69,7 @@ class KerberosManager implements Seriali
             public Subject call() throws Exception {
                 LoginContext loginCtx;
                 try {
-                    loginCtx = new LoginContext("Client",
+                    loginCtx = new LoginContext(JAAS_APPLICATION,
                             new LoginCallbackHandler(username, password));
                     loginCtx.login();
                     return loginCtx.getSubject();
@@ -79,6 +81,9 @@ class KerberosManager implements Seriali
         };
 
         FutureTask<Subject> task = new FutureTask<Subject>(callable);
+        if(log.isDebugEnabled()) {
+            log.debug("Subject cached:"+subjects.keySet() +" before:"+username);
+        }
         Future<Subject> subjectFuture = subjects.putIfAbsent(username, task);
         if (subjectFuture == null) {
             subjectFuture = task;
@@ -118,22 +123,22 @@ class KerberosManager implements Seriali
                     pc.setPassword(password.toCharArray());
                 } else {
                     throw new UnsupportedCallbackException( callback,
-                            "Unrecognized Callback");
+                            "Unrecognized Callback"); //$NON-NLS-1$
                 }
             }
         }
     }
     
     public String getKrb5Conf() {
-        return System.getProperty("java.security.krb5.conf");
+        return System.getProperty("java.security.krb5.conf"); //$NON-NLS-1$
     }
 
     public boolean getKrb5Debug() {
-        return Boolean.valueOf(System.getProperty("java.security.krb5.debug", "False"));
+        return Boolean.valueOf(System.getProperty("java.security.krb5.debug", "False"));
//$NON-NLS-1$ $NON-NLS-2$
     }
 
     public String getJaasConf() {
-        return System.getProperty("java.security.auth.login.config");
+        return System.getProperty("java.security.auth.login.config"); //$NON-NLS-1$
     }
     
     @Override



Mime
View raw message