geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r550920 - in /geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf: GeronimoDestination.java pojo/POJOEndpoint.java pojo/POJOWebServiceContainer.java pojo/POJOWebServiceContext.java
Date Tue, 26 Jun 2007 19:59:02 GMT
Author: gawor
Date: Tue Jun 26 12:59:00 2007
New Revision: 550920

URL: http://svn.apache.org/viewvc?view=rev&rev=550920
Log:
use SecurityContext class in CXF (simplifies our code)

Removed:
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContext.java
Modified:
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
    geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java?view=diff&rev=550920&r1=550919&r2=550920
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/GeronimoDestination.java
Tue Jun 26 12:59:00 2007
@@ -21,6 +21,7 @@
 import java.io.Serializable;
 import java.io.InputStream;
 import java.net.HttpURLConnection;
+import java.security.Principal;
 import java.util.Iterator;
 import java.util.ArrayList;
 import java.util.List;
@@ -35,6 +36,7 @@
 import org.apache.cxf.Bus;
 import org.apache.cxf.message.Message;
 import org.apache.cxf.message.MessageImpl;
+import org.apache.cxf.security.SecurityContext;
 import org.apache.cxf.service.model.EndpointInfo;
 import org.apache.cxf.transport.Conduit;
 import org.apache.cxf.transport.ConduitInitiator;
@@ -50,6 +52,7 @@
         implements Serializable {
 
     private MessageObserver messageObserver;
+    private boolean passSecurityContext = false;
 
     public GeronimoDestination(Bus bus, 
                                ConduitInitiator conduitInitiator, 
@@ -57,6 +60,14 @@
         super(bus, conduitInitiator, endpointInfo, true);
     }
 
+    public void setPassSecurityContext(boolean passSecurityContext) {
+        this.passSecurityContext = passSecurityContext;
+    }
+    
+    public boolean getPassSecurityContext() {
+        return this.passSecurityContext;
+    }
+    
     public EndpointInfo getEndpointInfo() {
         return this.endpointInfo;
     }
@@ -69,7 +80,7 @@
         message.put(Request.class, request);
         message.put(Response.class, response);
 
-        HttpServletRequest servletRequest = 
+        final HttpServletRequest servletRequest = 
             (HttpServletRequest)request.getAttribute(WebServiceContainer.SERVLET_REQUEST);
         message.put(MessageContext.SERVLET_REQUEST, servletRequest);
         
@@ -80,6 +91,17 @@
         ServletContext servletContext = 
             (ServletContext)request.getAttribute(WebServiceContainer.SERVLET_CONTEXT);
         message.put(MessageContext.SERVLET_CONTEXT, servletContext);
+        
+        if (this.passSecurityContext) {
+            message.put(SecurityContext.class, new SecurityContext() {
+                public Principal getUserPrincipal() {
+                    return servletRequest.getUserPrincipal();
+                }
+                public boolean isUserInRole(String role) {
+                    return servletRequest.isUserInRole(role);
+                }
+            });
+        }
         
         // this calls copyRequestHeaders()
         setHeaders(message);

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java?view=diff&rev=550920&r1=550919&r2=550920
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOEndpoint.java
Tue Jun 26 12:59:00 2007
@@ -24,6 +24,7 @@
 
 import org.apache.cxf.Bus;
 import org.apache.cxf.jaxws.JAXWSMethodInvoker;
+import org.apache.cxf.jaxws.context.WebServiceContextImpl;
 import org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean;
 import org.apache.geronimo.cxf.CXFEndpoint;
 import org.apache.geronimo.cxf.CXFServiceConfiguration;
@@ -65,7 +66,7 @@
         service.setInvoker(new JAXWSMethodInvoker(instance));       
 
         JNDIResolver jndiResolver = (JNDIResolver) bus.getExtension(JNDIResolver.class);
-        this.annotationProcessor = new JAXWSAnnotationProcessor(jndiResolver, new POJOWebServiceContext());
+        this.annotationProcessor = new JAXWSAnnotationProcessor(jndiResolver, new WebServiceContextImpl());
     }
     
     protected void init() {        

Modified: geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java?view=diff&rev=550920&r1=550919&r2=550920
==============================================================================
--- geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java
(original)
+++ geronimo/server/trunk/modules/geronimo-cxf/src/main/java/org/apache/geronimo/cxf/pojo/POJOWebServiceContainer.java
Tue Jun 26 12:59:00 2007
@@ -28,6 +28,7 @@
                                    URL configurationBaseUrl,                            
     
                                    Object target) {
         super(bus, configurationBaseUrl, target);
+        this.destination.setPassSecurityContext(true);
     }
 
     protected CXFEndpoint publishEndpoint(Object target) {



Mime
View raw message