You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by fm...@apache.org on 2011/08/03 00:39:08 UTC

svn commit: r1153296 - in /chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main: java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/ resources/META-INF/services/

Author: fmui
Date: Tue Aug  2 22:39:07 2011
New Revision: 1153296

URL: http://svn.apache.org/viewvc?rev=1153296&view=rev
Log:
CMIS-410: preliminary fix

Added:
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssMUTube.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubeAssembler.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubelineAssemblerFactory.java   (with props)
    chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory

Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssMUTube.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssMUTube.java?rev=1153296&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssMUTube.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssMUTube.java Tue Aug  2 22:39:07 2011
@@ -0,0 +1,86 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices.wss;
+
+import javax.xml.namespace.QName;
+
+import org.apache.chemistry.opencmis.commons.exceptions.CmisConnectionException;
+
+import com.sun.istack.NotNull;
+import com.sun.xml.ws.api.SOAPVersion;
+import com.sun.xml.ws.api.WSBinding;
+import com.sun.xml.ws.api.message.Header;
+import com.sun.xml.ws.api.message.HeaderList;
+import com.sun.xml.ws.api.message.Packet;
+import com.sun.xml.ws.api.pipe.NextAction;
+import com.sun.xml.ws.api.pipe.Tube;
+import com.sun.xml.ws.api.pipe.TubeCloner;
+import com.sun.xml.ws.api.pipe.helper.AbstractFilterTubeImpl;
+
+public class WssMUTube extends AbstractFilterTubeImpl {
+
+    private static final QName WSSE = new QName(
+            "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security");
+
+    private final SOAPVersion soapVersion;
+
+    protected WssMUTube(WSBinding binding, Tube next) {
+        super(next);
+        soapVersion = binding.getSOAPVersion();
+    }
+
+    protected WssMUTube(WssMUTube that, TubeCloner cloner) {
+        super(that, cloner);
+        soapVersion = that.soapVersion;
+    }
+
+    public WssMUTube copy(TubeCloner cloner) {
+        return new WssMUTube(this, cloner);
+    }
+
+    @Override
+    @NotNull
+    public NextAction processResponse(Packet response) {
+        if (response.getMessage() == null) {
+            return super.processResponse(response);
+        }
+
+        HeaderList headers = response.getMessage().getHeaders();
+
+        for (int i = 0; i < headers.size(); i++) {
+            if (!headers.isUnderstood(i)) {
+                Header header = headers.get(i);
+                if (!header.isIgnorable(soapVersion, soapVersion.implicitRoleSet)) {
+                    QName qName = new QName(header.getNamespaceURI(), header.getLocalPart());
+                    if (WSSE.equals(qName)) {
+                        checkSecurityHeader(header);
+                    } else {
+                        throw new CmisConnectionException("MustUnderstand header is not understood: " + qName);
+                    }
+                }
+            }
+        }
+
+        return super.processResponse(response);
+    }
+
+    private void checkSecurityHeader(Header header) {
+        // TODO
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssMUTube.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubeAssembler.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubeAssembler.java?rev=1153296&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubeAssembler.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubeAssembler.java Tue Aug  2 22:39:07 2011
@@ -0,0 +1,47 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices.wss;
+
+import com.sun.xml.ws.api.pipe.ClientTubeAssemblerContext;
+import com.sun.xml.ws.api.pipe.ServerTubeAssemblerContext;
+import com.sun.xml.ws.api.pipe.Tube;
+import com.sun.xml.ws.api.pipe.TubelineAssembler;
+
+public class WssTubeAssembler implements TubelineAssembler {
+
+    public Tube createClient(ClientTubeAssemblerContext context) {
+        Tube head = context.createTransportTube();
+        head = context.createSecurityTube(head);
+        head = context.createWsaTube(head);
+        head = new WssMUTube(context.getBinding(), head);
+
+        return context.createHandlerTube(head);
+    }
+
+    public Tube createServer(ServerTubeAssemblerContext context) {
+        Tube head = context.getTerminalTube();
+        head = context.createHandlerTube(head);
+        head = context.createMonitoringTube(head);
+        head = context.createServerMUTube(head);
+        head = context.createWsaTube(head);
+        head = context.createSecurityTube(head);
+
+        return head;
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubeAssembler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubelineAssemblerFactory.java
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubelineAssemblerFactory.java?rev=1153296&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubelineAssemblerFactory.java (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubelineAssemblerFactory.java Tue Aug  2 22:39:07 2011
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.chemistry.opencmis.client.bindings.spi.webservices.wss;
+
+import com.sun.xml.ws.api.BindingID;
+import com.sun.xml.ws.api.pipe.TubelineAssembler;
+import com.sun.xml.ws.api.pipe.TubelineAssemblerFactory;
+
+public class WssTubelineAssemblerFactory extends TubelineAssemblerFactory {
+
+    @Override
+    public TubelineAssembler doCreate(BindingID bindingID) {
+        return new WssTubeAssembler();
+    }
+}

Propchange: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/java/org/apache/chemistry/opencmis/client/bindings/spi/webservices/wss/WssTubelineAssemblerFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory
URL: http://svn.apache.org/viewvc/chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory?rev=1153296&view=auto
==============================================================================
--- chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory (added)
+++ chemistry/opencmis/trunk/chemistry-opencmis-client/chemistry-opencmis-client-bindings/src/main/resources/META-INF/services/com.sun.xml.ws.api.pipe.TubelineAssemblerFactory Tue Aug  2 22:39:07 2011
@@ -0,0 +1 @@
+org.apache.chemistry.opencmis.client.bindings.spi.webservices.wss.WssTubelineAssemblerFactory
\ No newline at end of file