geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r154217 - geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
Date Fri, 18 Feb 2005 00:15:50 GMT
Author: djencks
Date: Thu Feb 17 16:15:49 2005
New Revision: 154217

URL: http://svn.apache.org/viewcvs?view=rev&rev=154217
Log:
speculative implementation of propagating auth info to service ref

Modified:
    geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java

Modified: geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java?view=diff&r1=154216&r2=154217
==============================================================================
--- geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
(original)
+++ geronimo/trunk/modules/axis/src/java/org/apache/geronimo/axis/client/ServiceEndpointMethodInterceptor.java
Thu Feb 17 16:15:49 2005
@@ -18,10 +18,15 @@
 
 import java.lang.reflect.Method;
 import java.util.Arrays;
+import java.util.Set;
+
+import javax.security.auth.Subject;
 
 import net.sf.cglib.proxy.MethodInterceptor;
 import net.sf.cglib.proxy.MethodProxy;
 import org.apache.axis.client.Call;
+import org.apache.geronimo.security.ContextManager;
+import org.apache.geronimo.security.jaas.UsernamePasswordCredential;
 
 /**
  * @version $Rev:  $ $Date:  $
@@ -49,6 +54,18 @@
         operationInfo.prepareCall(call);
 
         stub.setUpCall(call);
+        Subject subject = ContextManager.getNextCaller();
+        if (subject == null) {
+            //is this an error?
+        } else {
+            Set creds = subject.getPrivateCredentials(UsernamePasswordCredential.class);
+            if (creds.size() != 1) {
+                throw new SecurityException("Non-unique UsernamePasswordCredential, count:
" + creds.size());
+            }
+            UsernamePasswordCredential usernamePasswordCredential = (UsernamePasswordCredential)
creds.iterator().next();
+            call.setUsername(usernamePasswordCredential.getUsername());
+            call.setPassword(new String(usernamePasswordCredential.getPassword()));
+        }
         java.lang.Object response = call.invoke(objects);
 
         if (response instanceof java.rmi.RemoteException) {



Mime
View raw message