[7/7] cxf git commit: add several tests back

2017-04-19 Thread ffang
add several tests back


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/9cffee53
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/9cffee53
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/9cffee53

Branch: refs/heads/websocket-undertow
Commit: 9cffee539adc2abd5eaf198e16fde082ca4b3e92
Parents: ebd1c24
Author: Freeman Fang 
Authored: Wed Apr 19 14:35:53 2017 +0800
Committer: Freeman Fang 
Committed: Wed Apr 19 14:35:53 2017 +0800

--
 .../systest/ws/rm/WSRMPolicyResolveTest.java|  52 ++
 .../systest/ws/policy/RM10PolicyWsdlTest.java   | 148 +++
 .../tools/wadlto/jaxrs/JAXRSContainerTest.java  | 921 +++
 3 files changed, 1121 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/9cffee53/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
--
diff --git 
a/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
 
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
new file mode 100644
index 000..6907c67
--- /dev/null
+++ 
b/systests/ws-rm/src/test/java/org/apache/cxf/systest/ws/rm/WSRMPolicyResolveTest.java
@@ -0,0 +1,52 @@
+/**
+ * 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.cxf.systest.ws.rm;
+
+
+import org.apache.cxf.test.AbstractCXFSpringTest;
+import org.apache.cxf.testutil.common.TestUtil;
+
+import org.junit.Test;
+
+import org.springframework.context.support.GenericApplicationContext;
+
+
+
+//CXF-4875
+public class WSRMPolicyResolveTest extends AbstractCXFSpringTest {
+public static final String PORT = 
TestUtil.getPortNumber(WSRMPolicyResolveTest.class);
+/** {@inheritDoc}*/
+@Override
+protected void additionalSpringConfiguration(GenericApplicationContext 
context) throws Exception {
+}
+
+@Test
+public void testHello() throws Exception {
+BasicDocEndpoint port = getApplicationContext().getBean("TestClient",
+  BasicDocEndpoint.class);
+Object retObj = port.echo("Hello");
+assertEquals("Hello", retObj);
+}
+
+/** {@inheritDoc}*/
+@Override
+protected String[] getConfigLocations() {
+return new String[] 
{"classpath:/org/apache/cxf/systest/ws/rm/wsrm-policy-resolve.xml" };
+}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cxf/blob/9cffee53/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java
--
diff --git 
a/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java
 
b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java
new file mode 100644
index 000..b19536f
--- /dev/null
+++ 
b/systests/ws-specs/src/test/java/org/apache/cxf/systest/ws/policy/RM10PolicyWsdlTest.java
@@ -0,0 +1,148 @@
+/**
+ * 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.cxf.systest.ws.policy;
+
+import java.io.Closeable;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.greeter_control.Greeter;
+import org.apache.cxf.greeter_co

[1/7] cxf git commit: add websocket undertow transport

2017-04-19 Thread ffang
Repository: cxf
Updated Branches:
  refs/heads/websocket-undertow [created] 9cffee539


http://git-wip-us.apache.org/repos/asf/cxf/blob/6755b06c/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/BookStoreWebSocket.java
--
diff --git 
a/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/BookStoreWebSocket.java
 
b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/BookStoreWebSocket.java
new file mode 100644
index 000..78f032c
--- /dev/null
+++ 
b/systests/transport-undertow/src/test/java/org/apache/cxf/systest/http_undertow/websocket/BookStoreWebSocket.java
@@ -0,0 +1,186 @@
+/**
+ * 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.cxf.systest.http_undertow.websocket;
+
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.HeaderParam;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.StreamingOutput;
+
+import org.apache.cxf.jaxrs.ext.StreamingResponse;
+import org.apache.cxf.transport.websocket.WebSocketConstants;
+
+@Path("/web/bookstore")
+public class BookStoreWebSocket {
+private static ExecutorService executor = 
Executors.newSingleThreadExecutor();
+private Map eventsStreams = new HashMap();
+
+@GET
+@Path("/booknames")
+@Produces("text/plain")
+public byte[] getBookName() {
+return "CXF in Action".getBytes();
+}
+
+@GET
+@Path("/booknames/servletstream")
+@Produces("text/plain")
+public void getBookNameStream(@Context HttpServletResponse response) 
throws Exception {
+OutputStream os = response.getOutputStream();
+response.setContentType("text/plain");
+os.write("CXF in Action".getBytes());
+os.flush();
+}
+
+@GET
+@Path("/books/{id}")
+@Produces("application/xml")
+public Book getBook(@PathParam("id") long id) {
+return new Book("CXF in Action", id);
+}
+
+@POST
+@Path("/booksplain")
+@Consumes("text/plain")
+@Produces("text/plain")
+public Long echoBookId(long theBookId) {
+return new Long(theBookId);
+}
+
+@GET
+@Path("/bookbought")
+@Produces("application/*")
+public StreamingOutput getBookBought() {
+return new StreamingOutput() {
+public void write(final OutputStream out) throws IOException, 
WebApplicationException {
+out.write(("Today: " + new java.util.Date()).getBytes());
+// just for testing, using a thread
+executor.execute(new Runnable() {
+public void run() {
+try {
+for (int r = 2, i = 1; i <= 5; r *= 2, i++) {
+Thread.sleep(500);
+out.write(Integer.toString(r).getBytes());
+out.flush();
+}
+out.close();
+} catch (Exception e) {
+e.printStackTrace();
+}
+}
+});
+}
+};
+}
+
+@GET
+@Path("/bookstream")
+@Produces("application/json")
+public StreamingResponse getBookStream() {
+return new StreamingResponse() {
+public void writeTo(final StreamingResponse.Writer out) 
throws IOException {
+out.write(new Book("WebSocket1", 1));
+executor.execute(new Runnable() {
+public void run() {
+try {
+for (int i = 2; i <= 5; i++) {
+ 

[6/7] cxf git commit: add UndertowWebSocketDestination when Atmosphere isn't available with more tests

2017-04-19 Thread ffang
add UndertowWebSocketDestination when Atmosphere isn't available with more tests


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ebd1c24d
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ebd1c24d
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ebd1c24d

Branch: refs/heads/websocket-undertow
Commit: ebd1c24df1b405bf0478f191ba055d96e8ccea41
Parents: a07135b
Author: Freeman Fang 
Authored: Wed Apr 19 14:28:37 2017 +0800
Committer: Freeman Fang 
Committed: Wed Apr 19 14:28:37 2017 +0800

--
 .../websocket/WebSocketDestinationFactory.java  |  19 +-
 .../AtmosphereWebSocketUndertowDestination.java |  22 +-
 .../undertow/UndertowWebSocketDestination.java  | 232 +
 .../WebSocketUndertowServletRequest.java|   6 +-
 ...RSClientServerWebSocketNoAtmosphereTest.java |  51 +
 ...ntServerWebSocketSpringNoAtmosphereTest.java |  52 ++
 .../JAXRSClientServerWebSocketSpringTest.java   |  48 +
 .../resources/jaxrs_websocket/WEB-INF/beans.xml |  54 ++
 .../resources/jaxrs_websocket/WEB-INF/web.xml   |  41 +
 .../jaxrs_websocket/beans-embedded.xml  |  48 +
 .../jaxrs_websocket/beans-embedded2.xml |  48 +
 .../systest/ws/rm/WSRMPolicyResolveTest.java|  52 --
 .../systest/ws/policy/RM10PolicyWsdlTest.java   | 148 ---
 .../tools/wadlto/jaxrs/JAXRSContainerTest.java  | 921 ---
 14 files changed, 601 insertions(+), 1141 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/ebd1c24d/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
--
diff --git 
a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
 
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
index bbd6f5a..40fd02e 100644
--- 
a/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
+++ 
b/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/WebSocketDestinationFactory.java
@@ -43,6 +43,8 @@ public class WebSocketDestinationFactory implements 
HttpDestinationFactory {
 private static final boolean UNDERTOW_AVAILABLE = 
probeClass("io.undertow.websockets.core.WebSockets");
 private static final Constructor JETTY9_WEBSOCKET_DESTINATION_CTR = 
 
probeConstructor("org.apache.cxf.transport.websocket.jetty9.Jetty9WebSocketDestination");
+private static final Constructor UNDERTOW_WEBSOCKET_DESTINATION_CTR = 
+
probeUndertowConstructor("org.apache.cxf.transport.websocket.undertow.UndertowWebSocketDestination");
 private static final Constructor 
ATMOSPHERE_WEBSOCKET_JETTY_DESTINATION_CTR = 
 
probeConstructor("org.apache.cxf.transport.websocket.atmosphere.AtmosphereWebSocketJettyDestination");
 private static final Constructor 
ATMOSPHERE_WEBSOCKET_UNDERTOW_DESTINATION_CTR = 
@@ -102,11 +104,20 @@ public class WebSocketDestinationFactory implements 
HttpDestinationFactory {
 }
 return null;
 } else {
-// for the embedded mode, we stick to jetty
-JettyHTTPServerEngineFactory serverEngineFactory = bus
-.getExtension(JettyHTTPServerEngineFactory.class);
-return 
createJettyHTTPDestination(JETTY9_WEBSOCKET_DESTINATION_CTR, bus, registry,
+if (JETTY_AVAILABLE) {
+// for the embedded mode, we stick to jetty if jetty is 
available
+JettyHTTPServerEngineFactory serverEngineFactory = bus
+.getExtension(JettyHTTPServerEngineFactory.class);
+return 
createJettyHTTPDestination(JETTY9_WEBSOCKET_DESTINATION_CTR, bus, registry,
   endpointInfo, 
serverEngineFactory);
+} else if (UNDERTOW_AVAILABLE) {
+// use UndertowWebSocketDestination
+UndertowHTTPServerEngineFactory 
undertowServerEngineFactory = bus
+.getExtension(UndertowHTTPServerEngineFactory.class);
+return 
createUndertowHTTPDestination(UNDERTOW_WEBSOCKET_DESTINATION_CTR, bus,
+ registry, 
endpointInfo, undertowServerEngineFactory);
+}
+return null;
 }
 } else {
 // REVISIT other way of getting the registry of http so that the 
plain cxf servlet finds the

http://git-wip-us.apache.org/repos/asf/cxf/blob/ebd1c24d/rt/transports/websocket/src/main/java/org/apache/cxf/transport/websocket/atmosphere/AtmosphereWebSocketUndertowDestination.java

[3/7] cxf git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf

2017-04-19 Thread ffang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a6e8702a
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a6e8702a
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a6e8702a

Branch: refs/heads/websocket-undertow
Commit: a6e8702a05fc642231abaaa6ac131360bb030fda
Parents: 6755b06 ba0573f
Author: Freeman Fang 
Authored: Mon Apr 17 12:16:29 2017 +0800
Committer: Freeman Fang 
Committed: Mon Apr 17 12:16:29 2017 +0800

--
 .../samples/jax_rs/sse_cdi/src/main/resources/META-INF/beans.xml   | 2 +-
 .../jax_rs/sse_spring/src/main/resources/META-INF/beans.xml| 2 +-
 integration/cdi/src/main/resources/META-INF/beans.xml  | 2 +-
 rt/rs/sse/src/main/resources/META-INF/beans.xml| 2 +-
 systests/cdi/base/src/main/resources/META-INF/beans.xml| 2 +-
 .../cdi-multiple-apps-owb/src/test/resources/META-INF/beans.xml| 2 +-
 .../cdi-owb/cdi-no-apps-owb/src/test/resources/META-INF/beans.xml  | 2 +-
 .../cdi-multiple-apps-weld/src/test/resources/META-INF/beans.xml   | 2 +-
 .../cdi-no-apps-weld/src/test/resources/META-INF/beans.xml | 2 +-
 9 files changed, 9 insertions(+), 9 deletions(-)
--




[5/7] cxf git commit: add UndertowWebSocketDestination when Atmosphere isn't available with more tests

2017-04-19 Thread ffang
http://git-wip-us.apache.org/repos/asf/cxf/blob/ebd1c24d/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
--
diff --git 
a/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
 
b/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
deleted file mode 100644
index 21d7dbb..000
--- 
a/tools/wadlto/jaxrs/src/test/java/org/apache/cxf/tools/wadlto/jaxrs/JAXRSContainerTest.java
+++ /dev/null
@@ -1,921 +0,0 @@
-/**
- * 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.cxf.tools.wadlto.jaxrs;
-
-import java.io.File;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Method;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.List;
-
-import javax.validation.Valid;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-
-import org.apache.cxf.helpers.FileUtils;
-import org.apache.cxf.jaxrs.ext.multipart.Multipart;
-import org.apache.cxf.tools.common.ProcessorTestBase;
-import org.apache.cxf.tools.common.ToolContext;
-import org.apache.cxf.tools.wadlto.WadlToolConstants;
-
-import org.junit.Test;
-
-public class JAXRSContainerTest extends ProcessorTestBase {
-
-@Test
-public void testNoTargetNamespace() {
-try {
-JAXRSContainer container = new JAXRSContainer(null);
-
-ToolContext context = new ToolContext();
-context.put(WadlToolConstants.CFG_OUTPUTDIR, 
output.getCanonicalPath());
-context.put(WadlToolConstants.CFG_WADLURL, 
getLocation("/wadl/resourceSchemaNoTargetNamespace.xml"));
-context.put(WadlToolConstants.CFG_SCHEMA_PACKAGENAME, "=custom");
-context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-container.setContext(context);
-container.execute();
-
-assertNotNull(output.list());
-List files = FileUtils.getFilesRecurse(output, ".+\\.class" 
+ "$");
-assertEquals(3, files.size());
-assertTrue(checkContains(files, "application" + 
".Resource.class"));
-assertTrue(checkContains(files, "custom" + 
".TestCompositeObject.class"));
-assertTrue(checkContains(files, "custom" + 
".ObjectFactory.class"));
-} catch (Exception e) {
-e.printStackTrace();
-fail();
-}
-}
-
-@Test
-public void testCodeGenInterfaces() {
-try {
-JAXRSContainer container = new JAXRSContainer(null);
-
-ToolContext context = new ToolContext();
-context.put(WadlToolConstants.CFG_OUTPUTDIR, 
output.getCanonicalPath());
-context.put(WadlToolConstants.CFG_WADLURL, 
getLocation("/wadl/bookstore.xml"));
-context.put(WadlToolConstants.CFG_MEDIA_TYPE_MAP,
-"application/xml=javax.xml.transform.Source");
-context.put(WadlToolConstants.CFG_MEDIA_TYPE_MAP,
-
"multipart/form-data=org.apache.cxf.jaxrs.ext.multipart.MultipartBody");
-context.put(WadlToolConstants.CFG_NO_VOID_FOR_EMPTY_RESPONSES, 
"true");
-
context.put(WadlToolConstants.CFG_GENERATE_RESPONSE_IF_HEADERS_SET, "true");
-context.put(WadlToolConstants.CFG_GENERATE_RESPONSE_FOR_METHODS, 
"getName");
-context.put(WadlToolConstants.CFG_COMPILE, "true");
-
-container.setContext(context);
-container.execute();
-
-assertNotNull(output.list());
-
-verifyFiles("java", true, false, "superbooks", 
"org.apache.cxf.jaxrs.model.wadl", 11, true);
-verifyFiles("class", true, false, "superbooks", 
"org.apache.cxf.jaxrs.model.wadl", 11, true);
-
-} catch (Exception e) {
-e.printStackTrace();
-fail();
-}
-}
-
-@Test
-public void testInheritParameters() {
-try {
-JAXRSContainer container = new JAXRSContainer(null)

[4/7] cxf git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf

2017-04-19 Thread ffang
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/cxf


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/a07135b1
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/a07135b1
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/a07135b1

Branch: refs/heads/websocket-undertow
Commit: a07135b12c37a406d29a8398330214ef8cc4b7d9
Parents: a6e8702 5e17bc0
Author: Freeman Fang 
Authored: Wed Apr 19 12:58:23 2017 +0800
Committer: Freeman Fang 
Committed: Wed Apr 19 12:58:23 2017 +0800

--
 integration/spring-boot/autoconfigure/pom.xml   | 37 +
 .../boot/autoconfigure/CxfProperties.java   |  6 +-
 .../boot/autoconfigure/CxfPropertiesTest.java   | 86 
 parent/pom.xml  |  2 +-
 pom.xml |  4 +-
 .../apache/cxf/jaxrs/impl/ResourceInfoImpl.java |  2 +-
 .../apache/cxf/jaxrs/utils/InjectionUtils.java  |  4 +-
 7 files changed, 133 insertions(+), 8 deletions(-)
--




[2/7] cxf git commit: add websocket undertow transport

2017-04-19 Thread ffang
add websocket undertow transport


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/6755b06c
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/6755b06c
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/6755b06c

Branch: refs/heads/websocket-undertow
Commit: 6755b06ca3eede0132d17633783800f3e3f07484
Parents: 156fd30
Author: Freeman Fang 
Authored: Thu Apr 13 14:04:55 2017 +0800
Committer: Freeman Fang 
Committed: Thu Apr 13 14:04:55 2017 +0800

--
 .../http_undertow/UndertowHTTPDestination.java  |   7 +-
 .../http_undertow/UndertowHTTPHandler.java  |   6 +
 rt/transports/websocket/pom.xml |   6 +
 .../websocket/WebSocketDestinationFactory.java  |  87 ++-
 .../AtmosphereWebSocketUndertowDestination.java | 302 ++
 .../undertow/ByteBufferInputStream.java |  51 ++
 .../WebSocketUndertowServletRequest.java| 589 +++
 .../WebSocketUndertowServletResponse.java   | 392 
 systests/transport-undertow/pom.xml |  61 ++
 .../systest/http_undertow/websocket/Book.java   | 123 
 .../websocket/BookNotFoundDetails.java  |  36 ++
 .../websocket/BookNotFoundFault.java|  41 ++
 .../websocket/BookServerWebSocket.java  |  83 +++
 .../websocket/BookStorePerRequest.java  | 129 
 .../websocket/BookStoreWebSocket.java   | 186 ++
 .../http_undertow/websocket/Chapter.java| 106 
 .../JAXRSClientServerWebSocketTest.java | 482 +++
 .../JAXRSClientServerWebSocketTest.java.bak | 438 ++
 .../http_undertow/websocket/SuperBook.java  |  45 ++
 .../websocket/SuperBookInterface.java   |  23 +
 .../websocket/WebSocketTestClient.java  | 329 +++
 21 files changed, 3498 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/6755b06c/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
--
diff --git 
a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
 
b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
index 81a4e59..b96c1b9 100644
--- 
a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
+++ 
b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPDestination.java
@@ -80,9 +80,6 @@ public class UndertowHTTPDestination extends 
ServletDestination {
 //Add the default port if the address is missing it
 super(bus, registry, ei, getAddressValue(ei, true).getAddress(), true);
 this.serverEngineFactory = serverEngineFactory;
-if (serverEngineFactory != null) {
-nurl = new URL(getAddress(endpointInfo));
-}
 loader = bus.getExtension(ClassLoader.class);
 }
 
@@ -101,6 +98,8 @@ public class UndertowHTTPDestination extends 
ServletDestination {
IOException {
 if (serverEngineFactory == null) {
 return;
+} else { 
+nurl = new URL(getAddress(endpointInfo));
 }
 engine =
 
serverEngineFactory.retrieveUndertowHTTPServerEngine(nurl.getPort());
@@ -239,7 +238,7 @@ public class UndertowHTTPDestination extends 
ServletDestination {
 }
 
 
-protected final String getAddress(EndpointInfo endpointInfo) {
+protected String getAddress(EndpointInfo endpointInfo) {
 return endpointInfo.getAddress();
 }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/6755b06c/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
--
diff --git 
a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
 
b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
index 2c1914a..ff05c97 100644
--- 
a/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
+++ 
b/rt/transports/http-undertow/src/main/java/org/apache/cxf/transport/http_undertow/UndertowHTTPHandler.java
@@ -66,6 +66,10 @@ public class UndertowHTTPHandler implements HttpHandler {
 }
 }
 
+public ServletContext getServletContext() {
+return this.servletContext;
+}
+
 public void setName(String name) {
 urlName = name;
 }
@@ -87,6 +91,8 @@ public class UndertowHTTPHandler implements HttpHandler {
 undertowExchange.dispatch(this);
 retur

cxf git commit: Disabling CxfPropertiesTest for now in 3.1.x due to a mix up of Spring deps on the test classpath

2017-04-19 Thread sergeyb
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes b31251dae -> c5c8f2d97


Disabling CxfPropertiesTest for now in 3.1.x due to a mix up of Spring deps on 
the test classpath


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/c5c8f2d9
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/c5c8f2d9
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/c5c8f2d9

Branch: refs/heads/3.1.x-fixes
Commit: c5c8f2d97021634d8df299b4743974d2cdb828e4
Parents: b31251d
Author: Sergey Beryozkin 
Authored: Wed Apr 19 17:49:57 2017 +0100
Committer: Sergey Beryozkin 
Committed: Wed Apr 19 17:49:57 2017 +0100

--
 .../cxf/spring/boot/autoconfigure/CxfPropertiesTest.java   | 6 ++
 parent/pom.xml | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/c5c8f2d9/integration/spring-boot/autoconfigure/src/test/java/org/apache/cxf/spring/boot/autoconfigure/CxfPropertiesTest.java
--
diff --git 
a/integration/spring-boot/autoconfigure/src/test/java/org/apache/cxf/spring/boot/autoconfigure/CxfPropertiesTest.java
 
b/integration/spring-boot/autoconfigure/src/test/java/org/apache/cxf/spring/boot/autoconfigure/CxfPropertiesTest.java
index b38b819..0017f1b 100644
--- 
a/integration/spring-boot/autoconfigure/src/test/java/org/apache/cxf/spring/boot/autoconfigure/CxfPropertiesTest.java
+++ 
b/integration/spring-boot/autoconfigure/src/test/java/org/apache/cxf/spring/boot/autoconfigure/CxfPropertiesTest.java
@@ -22,6 +22,7 @@ package org.apache.cxf.spring.boot.autoconfigure;
 import javax.validation.ConstraintViolationException;
 
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -32,6 +33,7 @@ import org.springframework.test.context.ContextConfiguration;
 import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import 
org.springframework.validation.beanvalidation.MethodValidationPostProcessor;
 
+
 @ContextConfiguration(classes = {CxfPropertiesTest.Config.class})
 @RunWith(SpringJUnit4ClassRunner.class)
 public class CxfPropertiesTest extends Assert {
@@ -53,16 +55,19 @@ public class CxfPropertiesTest extends Assert {
 private CxfProperties cxfproperties;
 
 @Test
+@Ignore
 public void throwsViolationExceptionWhenIsNull() {
 doTestInvalidPath(null);
 }
 
 @Test
+@Ignore
 public void throwsViolationExceptionWhenPathIsEmpty() {
 doTestInvalidPath("");
 }
 
 @Test
+@Ignore
 public void throwsViolationExceptionWhenHasNoSlash() {
 doTestInvalidPath("invalid");
 }
@@ -78,6 +83,7 @@ public class CxfPropertiesTest extends Assert {
 }
 
 @Test
+@Ignore
 public void noViolationExceptionWhenPathValid() {
 cxfproperties.setPath("/valid");
 cxfproperties.getPath();

http://git-wip-us.apache.org/repos/asf/cxf/blob/c5c8f2d9/parent/pom.xml
--
diff --git a/parent/pom.xml b/parent/pom.xml
index 3b08d96..4421b3f 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -150,7 +150,7 @@
 1.7.24
 1.2
 4.1.9.RELEASE
-1.4.4.RELEASE
+1.4.5.RELEASE
 
3.2.10.RELEASE
 1.2.1
 2.2.1.RELEASE



cxf git commit: Recording .gitmergeinfo Changes

2017-04-19 Thread coheigea
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 3ebaf8501 -> db6653c65


Recording .gitmergeinfo Changes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/db6653c6
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/db6653c6
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/db6653c6

Branch: refs/heads/3.0.x-fixes
Commit: db6653c6579cf2c41a676f38e7902b87f1630866
Parents: 3ebaf85
Author: Colm O hEigeartaigh 
Authored: Wed Apr 19 15:54:26 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 15:54:26 2017 +0100

--
 .gitmergeinfo | 6 ++
 1 file changed, 6 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/db6653c6/.gitmergeinfo
--
diff --git a/.gitmergeinfo b/.gitmergeinfo
index e5e0045..143c6fe 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -782,6 +782,7 @@ B 72f0980e49e9249e75c3cfcef39602b27d3a92a4
 B 731d7df1181d717e2dc867c9e00118f974de6179
 B 736e7d464e3a6261ecfc041709924b7effc00cce
 B 73cce96fa123c8a4245269157692fb6f596dfc9b
+B 73f8c955d8f593928b1f00586043e14daf5d5242
 B 741a74e33bc29f7ada4f5f908ec4fcbee55dc011
 B 742cb68a9172c968aeea5ece7146f9c3dfacde9a
 B 743b191f333a49c527f2e750d7d03aa0ea30af33
@@ -876,6 +877,7 @@ B 82c4bff5276cc32490507fba4cb9d18539d41907
 B 83846d088d78a03159b259fb9969052a33904faa
 B 838c97fdffa333db3adf5d3a2ce4547d366fa6e9
 B 83cc8bf11f0ec98f7ef8aca3d3b775943ad05811
+B 83ec8960e673fd5901b0a586c0920966d8ff638f
 B 842880b3527f0c97bbd1d1dc9f6e1e2aeba21a0a
 B 842fade62621490a407729fa1357f043216f25e6
 B 845c3decbf1221fde2ec5111d202fcaa78a76f06
@@ -1011,6 +1013,7 @@ B 997521186771645706fbee26e3c55094f17547e6
 B 998b35ea20b1c37bd8b9dc3f4bc0396ee35a486a
 B 99963f9a08c9782b7c661f2b5ff8e9ce95ab3dbe
 B 99c5d66eb922e4fd3e68011c4d6eab2a2c8b53ad
+B 99e6c4fa038ef2a8beeac4873876b5cf8a45c31d
 B 99f4092de01d60b8369ff84036d543e9d20ecefc
 B 9a2a8adc89a098218cf43ce9a6b68e50b6fea32c
 B 9a2c82620001b76a2065960686f9bc8f384c4d58
@@ -1191,6 +1194,7 @@ B b2bad7f9eba17cac427edbab18b4b6f9c8ef7556
 B b2e34286753bf61581fa084a90f6707918042419
 B b2f6ad83021c1ff4c1f3118bbe4b27b938842f01
 B b301d5628e0c239cd2c2bd24695e52d746114e17
+B b31251dae4cc32835669b3644e485b4773d3550b
 B b345217598f874f7c4a4966731fe68bcbe9900c3
 B b3679092603a89574d597035c23e3d3662a796a4
 B b38e4510c2063e234d6fe02231693a0a281a0147
@@ -1390,6 +1394,7 @@ B d1687e70dc8b0e8571cc7dfebbd173ec1ccb1c32
 B d1b2a3d0ab6368ae519498572b72267388859635
 B d1bb6c14ce0e9431adedc324bcf069209d9fe4d8
 B d1c7f1f6be4ce14bd0e99ec9672d9c1957515f35
+B d1c82251965fcac68c9829844870e726c73e9e25
 B d1f0aff92702d72d4dcdd5a8630e37a4bc807b27
 B d2179fbe499b8d32118b420c8f19bb3c348f1234
 B d2ed88ccb247d4105de34a5b675c0fc198795209
@@ -1474,6 +1479,7 @@ B de9b7936156d622c284df7f055acac80b920b7d0
 B deea740143ef9b2d85c5dc2139f6918ae10ca548
 B df39a9e14be1f3ff1fdd32e93e4f95c7fab96b00
 B df424f5a46f5a6e7be339308d85799865fb84573
+B df51c99d9a708974a124052bb965494797c22e8c
 B df54745da1a568ea652762a3f0840771551b8d27
 B df947cb1ca2b9e375f99e199ec65b1afece1c963
 B dfa36ecb161fc0e7121aff68ad41ed969307d4f0



[3/3] cxf git commit: Fixing merge

2017-04-19 Thread coheigea
Fixing merge


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/b31251da
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/b31251da
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/b31251da

Branch: refs/heads/3.1.x-fixes
Commit: b31251dae4cc32835669b3644e485b4773d3550b
Parents: 83ec896
Author: Colm O hEigeartaigh 
Authored: Wed Apr 19 15:34:29 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 15:34:29 2017 +0100

--
 .../java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java | 3 ---
 1 file changed, 3 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/b31251da/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
--
diff --git 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
index b4abf6b..7a517d3 100644
--- 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
+++ 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
@@ -332,13 +332,10 @@ public class XmlSecOutInterceptor extends 
AbstractPhaseInterceptor {
 if (sigProps.getSignatureC14nTransform() != null) {
 transform = sigProps.getSignatureC14nTransform();
 }
-<<< HEAD
-===
 
 if (sigProps.getSignatureLocation() != null) {
 properties.setSignaturePosition(sigProps.getSignatureLocation());
 }
->>> be99c53... CXF-7340 Add an option to specify the location of the 
signature element
 
 if (elementsToSign == null || elementsToSign.isEmpty()) {
 LOG.fine("No Elements to sign are specified, so the entire request 
is signed");



[2/3] cxf git commit: CXF-7340 Add an option to specify the location of the signature element

2017-04-19 Thread coheigea
CXF-7340 Add an option to specify the location of the signature element

Signed-off-by: Colm O hEigeartaigh 

This closes #263

# Conflicts:
#   
rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/d1c82251
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/d1c82251
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/d1c82251

Branch: refs/heads/3.1.x-fixes
Commit: d1c82251965fcac68c9829844870e726c73e9e25
Parents: a78c589
Author: Hugo Trippaers 
Authored: Tue Oct 25 14:42:56 2016 +0200
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 15:34:22 2017 +0100

--
 .../org/apache/cxf/rs/security/xml/SignatureProperties.java  | 8 
 .../org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java | 7 +++
 2 files changed, 15 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/d1c82251/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
--
diff --git 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
index 235d70e..412e40e 100644
--- 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
+++ 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
@@ -28,6 +28,7 @@ public class SignatureProperties {
 private String signatureKeyIdType;
 private String signatureKeyName;
 private Map keyNameAliasMap;
+private Integer signatureLocation;
 
 public void setSignatureAlgo(String signatureAlgo) {
 this.signatureAlgo = signatureAlgo;
@@ -95,4 +96,11 @@ public class SignatureProperties {
 this.keyNameAliasMap = keyNameAliasMap;
 }
 
+public Integer getSignatureLocation() {
+return signatureLocation;
+}
+
+public void setSignatureLocation(Integer signatureLocation) {
+this.signatureLocation = signatureLocation;
+}
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/d1c82251/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
--
diff --git 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
index 9018772..b4abf6b 100644
--- 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
+++ 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
@@ -332,6 +332,13 @@ public class XmlSecOutInterceptor extends 
AbstractPhaseInterceptor {
 if (sigProps.getSignatureC14nTransform() != null) {
 transform = sigProps.getSignatureC14nTransform();
 }
+<<< HEAD
+===
+
+if (sigProps.getSignatureLocation() != null) {
+properties.setSignaturePosition(sigProps.getSignatureLocation());
+}
+>>> be99c53... CXF-7340 Add an option to specify the location of the 
signature element
 
 if (elementsToSign == null || elementsToSign.isEmpty()) {
 LOG.fine("No Elements to sign are specified, so the entire request 
is signed");



[1/3] cxf git commit: Recording .gitmergeinfo Changes

2017-04-19 Thread coheigea
Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes a78c5891a -> b31251dae


Recording .gitmergeinfo Changes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/83ec8960
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/83ec8960
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/83ec8960

Branch: refs/heads/3.1.x-fixes
Commit: 83ec8960e673fd5901b0a586c0920966d8ff638f
Parents: d1c8225
Author: Colm O hEigeartaigh 
Authored: Wed Apr 19 15:34:22 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 15:34:22 2017 +0100

--
 .gitmergeinfo | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/83ec8960/.gitmergeinfo
--
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 2e4926a..0dbf0f3 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -503,6 +503,7 @@ M b49075882641fcebbbdf1ed8d84247fcf80aa558
 M b624c034c5682b54b9faf3d3e90eb0c23cde1a5b
 M b77e43f19d631d94032740eff6e58f49e0532d29
 M be2bf8d644887fc1853210b9b82db897c4d73dd0
+M be99c53015cb37a692d2e4dbe3682c7407f29b99
 M c01c68ddda10ec6db492b86d818498bec0bf4228
 M c212240f696e3387df19bbcf22d1851aff320078
 M c2b13b7473781c3c1a4225a01c319cf8aa92cd0f



cxf git commit: CXF-7340 Add an option to specify the location of the signature element

2017-04-19 Thread coheigea
Repository: cxf
Updated Branches:
  refs/heads/master 41a97e477 -> be99c5301


CXF-7340 Add an option to specify the location of the signature element

Signed-off-by: Colm O hEigeartaigh 

This closes #263


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/be99c530
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/be99c530
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/be99c530

Branch: refs/heads/master
Commit: be99c53015cb37a692d2e4dbe3682c7407f29b99
Parents: 41a97e4
Author: Hugo Trippaers 
Authored: Tue Oct 25 14:42:56 2016 +0200
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 15:32:44 2017 +0100

--
 .../org/apache/cxf/rs/security/xml/SignatureProperties.java  | 8 
 .../org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java | 4 
 2 files changed, 12 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/be99c530/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
--
diff --git 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
index 13cd047..28fae88 100644
--- 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
+++ 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/SignatureProperties.java
@@ -28,6 +28,7 @@ public class SignatureProperties {
 private String signatureKeyIdType;
 private String signatureKeyName;
 private Map keyNameAliasMap;
+private Integer signatureLocation;
 
 public void setSignatureAlgo(String signatureAlgo) {
 this.signatureAlgo = signatureAlgo;
@@ -79,4 +80,11 @@ public class SignatureProperties {
 this.keyNameAliasMap = keyNameAliasMap;
 }
 
+public Integer getSignatureLocation() {
+return signatureLocation;
+}
+
+public void setSignatureLocation(Integer signatureLocation) {
+this.signatureLocation = signatureLocation;
+}
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/be99c530/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
--
diff --git 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
index 904a92b..309dc57 100644
--- 
a/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
+++ 
b/rt/rs/security/xml/src/main/java/org/apache/cxf/rs/security/xml/XmlSecOutInterceptor.java
@@ -333,6 +333,10 @@ public class XmlSecOutInterceptor extends 
AbstractPhaseInterceptor {
 transform = sigProps.getSignatureC14nTransform();
 }
 
+if (sigProps.getSignatureLocation() != null) {
+properties.setSignaturePosition(sigProps.getSignatureLocation());
+}
+
 if (elementsToSign == null || elementsToSign.isEmpty()) {
 LOG.fine("No Elements to sign are specified, so the entire request 
is signed");
 SecurePart securePart =



cxf git commit: [CXF-6778] reset cached destination in case of exception

2017-04-19 Thread cschneider
Repository: cxf
Updated Branches:
  refs/heads/master 5e17bc043 -> 41a97e477


[CXF-6778] reset cached destination in case of exception


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/41a97e47
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/41a97e47
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/41a97e47

Branch: refs/heads/master
Commit: 41a97e477318914fd938ef0f3d6a9f263abfa7cc
Parents: 5e17bc0
Author: Christian Schneider 
Authored: Wed Apr 19 14:57:49 2017 +0200
Committer: Christian Schneider 
Committed: Wed Apr 19 14:57:49 2017 +0200

--
 .../cxf/transport/jms/JMSConfiguration.java | 27 
 .../apache/cxf/transport/jms/JMSFactory.java| 10 +++-
 2 files changed, 25 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/41a97e47/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
--
diff --git 
a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
 
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
index 4b1052d..8498a65 100644
--- 
a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
+++ 
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
@@ -79,11 +79,6 @@ public class JMSConfiguration {
 private String replyToDestination;
 private volatile Destination replyToDestinationDest;
 
-/**
- * Session that was used to cache the replyToDestinationDest
- */
-private volatile Session replyDestinationSession;
-
 private String messageType = JMSConstants.TEXT_MESSAGE_TYPE;
 private boolean pubSubDomain;
 private boolean replyPubSubDomain;
@@ -468,19 +463,29 @@ public class JMSConfiguration {
 }
 
 public Destination getReplyDestination(Session session) throws 
JMSException {
-if (this.replyDestinationDest == null || this.replyDestinationSession 
== null) {
+if (this.replyDestinationDest == null) {
 synchronized (this) {
-if (this.replyDestinationDest == null || 
this.replyDestinationSession == null) {
-this.replyDestinationDest = replyDestination == null
-? session.createTemporaryQueue()
-: destinationResolver.resolveDestinationName(session, 
replyDestination, replyPubSubDomain);
-this.replyDestinationSession = session;
+if (this.replyDestinationDest == null) {
+this.replyDestinationDest = 
getReplyDestinationInternal(session);
 }
 }
 }
 return this.replyDestinationDest;
 }
 
+private Destination getReplyDestinationInternal(Session session) throws 
JMSException {
+return replyDestination == null
+? session.createTemporaryQueue()
+: destinationResolver.resolveDestinationName(session, 
replyDestination, replyPubSubDomain);
+}
+
+public void resetCachedReplyDestination() {
+synchronized (this) {
+this.replyDestination = null;
+}
+}
+
+
 public Destination getTargetDestination(Session session) throws 
JMSException {
 return destinationResolver.resolveDestinationName(session, 
targetDestination, pubSubDomain);
 }

http://git-wip-us.apache.org/repos/asf/cxf/blob/41a97e47/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
--
diff --git 
a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java 
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
index 68b6173..e8ebc29 100644
--- 
a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
+++ 
b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSFactory.java
@@ -23,6 +23,7 @@ import java.util.concurrent.Executors;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
+import javax.jms.ExceptionListener;
 import javax.jms.JMSException;
 
 import org.apache.cxf.Bus;
@@ -77,7 +78,7 @@ public final class JMSFactory {
 return correlationIdPrefix.isEmpty() ? null : "JMSCorrelationID LIKE 
'" + correlationIdPrefix + "%'";
 }
 
-public static Connection createConnection(JMSConfiguration jmsConfig) 
throws JMSException {
+public static Connection createConnection(final JMSConfiguration 
jmsConfig) throws JMSException {
 String username = jmsConfig.getUserName();
 ConnectionFactory cf = jmsConfig.getConnectionFactory();
 Connection connection = username != null
@@ -86,6 +87,13 @@ public final class

svn commit: r1010714 - in /websites/production/cxf/content: cache/main.pageCache people.html

2017-04-19 Thread buildbot
Author: buildbot
Date: Wed Apr 19 12:47:42 2017
New Revision: 1010714

Log:
Production update by buildbot for cxf

Modified:
websites/production/cxf/content/cache/main.pageCache
websites/production/cxf/content/people.html

Modified: websites/production/cxf/content/cache/main.pageCache
==
Binary files - no diff available.

Modified: websites/production/cxf/content/people.html
==
--- websites/production/cxf/content/people.html (original)
+++ websites/production/cxf/content/people.html Wed Apr 19 12:47:42 2017
@@ -99,7 +99,7 @@ Apache CXF -- People
  


-CXF 
CommunityThis page lists who we are.Committers "A committer is a developer that 
was given write access to the code repository and has a signed Contributor 
License Agreement (http://www.apache.org/licenses/icla.txt";>CLA) on file. They have an 
apache.org mail address. Not needing to depend on other people for the patches, 
they are actually making short-term decisions for the project. The PMC can 
(even tacitly) agree and approve it into permanency, or they can reject it. 
Remember that the PMC makes the decisions, not the individual people." – 
from http://www.apache.org/foundation/how-it-works.html";>How the ASF 
worksNameIDPMC Memberhttp://janbernhardt.blogspot.com/"; rel="nofollow">Jan 
Bernhardthttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=jan4talend";>jbernhardthttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">http://sberyozkin.blogspot.com/"; rel="nofollow">Sergey 
Beryozkinhttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=sergey_beryozkin";>sergey_beryozkinhttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">http://ulhasbhole.blogspot.com"; rel="nofollow">Ulhas 
Bholehttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=ulhasbhole";>ulhasbholehttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_
 /images/icons/emoticons/check.png" data-emoticon-name="tick" 
alt="(tick)">http://www.coderthoughts.org"; rel="nofollow">David 
Bosschaerthttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=davidb";>davidbhttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">http://freemanfang.blogspot.com/"; rel="nofollow">Freeman 
Fangffanghttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">http://thoughts.bharathganesh.com"; rel="nofollow">Bharath 
Ganeshhttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=bharath";>bharath Jarek Gaworhttps://issues.apache.org/jira/secure/Vi
 ewProfile.jspa?name=gawor">gaworhttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">Jeff Genenderhttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=jgenender";>jgenenderhttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">Eoghan Glynnhttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=eglynn";>eglynnhttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">Unreal Jianghttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=unrealjiang";>unrealjiang http://willemjiang.blogspot.com/"; 
rel="nofollow">Willem Jianghttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=ningjiang";>ningjianghttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">Eric Johnsonhttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=ericjohnson";>ericjohnsonhttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">http://dankulp.com/blog"; rel="nofollow">Daniel 
Kulphttps://issues.apache.org/jira/secure/ViewProfile.jspa?name=dkulp";>dkulphttps://cwiki.apache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0ae18646be7.1/_/images/icons/emoticons/check.png";
 data-emoticon-name="tick" alt="(tick)">http://maerqiang.blogspot.com"; rel="nofollow">Jim Ma https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ema";>emahttps://cwiki.ap
 
ache.org/confluence/s/en_GB/5982/f2b47fb3d636c8bc9fd0b11c0ec6d0

cxf-fediz git commit: Distinguishing between unauthorized and forbidden statuses

2017-04-19 Thread sergeyb
Repository: cxf-fediz
Updated Branches:
  refs/heads/master bdf7729d9 -> 2d811fa6a


Distinguishing between unauthorized and forbidden statuses


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/2d811fa6
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/2d811fa6
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/2d811fa6

Branch: refs/heads/master
Commit: 2d811fa6afebfd6d5f1625f28ee10d28c48ac891
Parents: bdf7729
Author: Sergey Beryozkin 
Authored: Wed Apr 19 13:32:23 2017 +0100
Committer: Sergey Beryozkin 
Committed: Wed Apr 19 13:32:23 2017 +0100

--
 .../fediz/service/oidc/clients/ClientRegistrationService.java  | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/2d811fa6/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
--
diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
index 177758c..cd28d33 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
+++ 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
@@ -362,8 +362,10 @@ public class ClientRegistrationService {
 
 private void checkSecurityContext() {
 SecurityContext sc = mc.getSecurityContext();
-if (sc == null || sc.getUserPrincipal() == null 
-|| userRole != null && !sc.isUserInRole(userRole)) {
+if (sc == null || sc.getUserPrincipal() == null) {
+throw ExceptionUtils.toNotAuthorizedException(null,  null); 
+}
+if (userRole != null && !sc.isUserInRole(userRole)) {
 throw ExceptionUtils.toForbiddenException(null,  null); 
 }
 }



cxf-fediz git commit: Enforcing the user working with the clientregservice is authenticated and is optionally in a specific role

2017-04-19 Thread sergeyb
Repository: cxf-fediz
Updated Branches:
  refs/heads/master 4b9aaf230 -> bdf7729d9


Enforcing the user working with the clientregservice is authenticated and is 
optionally in a specific role


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/bdf7729d
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/bdf7729d
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/bdf7729d

Branch: refs/heads/master
Commit: bdf7729d9cdb5afa957cada2f5456744a1151a57
Parents: 4b9aaf2
Author: Sergey Beryozkin 
Authored: Wed Apr 19 13:28:48 2017 +0100
Committer: Sergey Beryozkin 
Committed: Wed Apr 19 13:28:48 2017 +0100

--
 .../oidc/clients/ClientRegistrationService.java | 47 ++--
 1 file changed, 34 insertions(+), 13 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/bdf7729d/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
--
diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
index 6dded2d..177758c 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
+++ 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
@@ -59,6 +59,7 @@ import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.fediz.service.oidc.CSRFUtils;
 import org.apache.cxf.jaxrs.ext.MessageContext;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
@@ -85,6 +86,7 @@ public class ClientRegistrationService {
 private Map clientScopes;
 
 private MessageContext mc;
+private String userRole;
 
 @Context
 public void setMessageContext(MessageContext messageContext) {
@@ -95,6 +97,7 @@ public class ClientRegistrationService {
 @Produces(MediaType.TEXT_HTML)
 @Path("/register")
 public RegisterClient registerStart() {
+checkSecurityContext();
 return new RegisterClient(homeRealms);
 }
 
@@ -102,6 +105,7 @@ public class ClientRegistrationService {
 @Produces(MediaType.TEXT_HTML)
 @Path("/")
 public RegisteredClients getClients() {
+checkSecurityContext();
 return new RegisteredClients(getClientRegistrations());
 }
 
@@ -109,6 +113,7 @@ public class ClientRegistrationService {
 @Produces(MediaType.TEXT_HTML)
 @Path("/{id}")
 public Client getRegisteredClient(@PathParam("id") String id) {
+checkSecurityContext();
 for (Client c : getClientRegistrations()) {
 if (c.getClientId().equals(id)) {
 return c;
@@ -126,7 +131,8 @@ public class ClientRegistrationService {
   @FormParam("client_csrfToken") 
String csrfToken) {
 // CSRF
 checkCSRFToken(csrfToken);
-
+checkSecurityContext();
+
 Collection clients = getClientRegistrations();
 for (Iterator it = clients.iterator(); it.hasNext();) {
 Client c = it.next();
@@ -150,6 +156,7 @@ public class ClientRegistrationService {
   @FormParam("client_csrfToken") String csrfToken) 
{
 // CSRF
 checkCSRFToken(csrfToken);
+checkSecurityContext();
 
 Client c = getRegisteredClient(id);
 if (c.isConfidential()) {
@@ -163,6 +170,7 @@ public class ClientRegistrationService {
 @Produces(MediaType.TEXT_HTML)
 @Path("/{id}/tokens")
 public ClientTokens getClientIssuedTokens(@PathParam("id") String id) {
+checkSecurityContext();
 Client c = getRegisteredClient(id);
 return doGetClientIssuedTokens(c);
 }
@@ -185,10 +193,8 @@ public class ClientRegistrationService {
 public ClientTokens revokeClientAccessToken(@PathParam("id") String 
clientId,
   @PathParam("tokenId") 
String tokenId,
   
@FormParam("client_csrfToken") String csrfToken) {
-// CSRF
-checkCSRFToken(csrfToken);
-
-return doRevokeClientToken(clientId, tokenId, 
OAuthConstants.ACCESS_TOKEN);
+
+return doRevokeClientToken(clientId, csrfToken, tokenId, 
OAuthConstants.ACCESS_TOKEN);
 }
 
 @POST
@@ -198,15 +204,17 @@ public class ClientRegistrationService {
 public ClientTokens revokeClien

cxf-fediz git commit: Injecting MessageContext instead following feedback from Sergey

2017-04-19 Thread coheigea
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.3.x-fixes 8aeeed22a -> 035c43406


Injecting MessageContext instead following feedback from Sergey


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/035c4340
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/035c4340
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/035c4340

Branch: refs/heads/1.3.x-fixes
Commit: 035c434068233a5773dc5853be1489a6ca1f09cf
Parents: 8aeeed2
Author: Colm O hEigeartaigh 
Authored: Wed Apr 19 11:46:02 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 12:20:07 2017 +0100

--
 .../oidc/clients/ClientRegistrationService.java  | 15 +++
 .../service/oidc/console/UserConsoleService.java | 10 ++
 2 files changed, 13 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/035c4340/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
--
diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
index 50b38ad..90b2aff 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
+++ 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
@@ -58,8 +58,7 @@ import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.fediz.service.oidc.CSRFUtils;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
@@ -71,7 +70,6 @@ import 
org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.apache.cxf.rs.security.oidc.idp.OidcUserSubject;
 import org.apache.cxf.rt.security.crypto.CryptoUtils;
-import org.apache.cxf.transport.http.AbstractHTTPDestination;
 
 @Path("/")
 public class ClientRegistrationService {
@@ -86,11 +84,11 @@ public class ClientRegistrationService {
 private boolean protectIdTokenWithClientSecret;
 private Map clientScopes;
 
-private SecurityContext sc;
+private MessageContext mc;
 
 @Context
-public void setSecurityContext(SecurityContext securityContext) {
-this.sc = securityContext;
+public void setMessageContext(MessageContext messageContext) {
+this.mc = messageContext;
 }
 
 @GET
@@ -283,6 +281,7 @@ public class ClientRegistrationService {
 Client newClient = new Client(clientId, clientSecret, isConfidential, 
appName);
 
 // User who registered this client
+SecurityContext sc = mc.getSecurityContext();
 String userName = sc.getUserPrincipal().getName();
 UserSubject userSubject = new OidcUserSubject(userName);
 newClient.setResourceOwnerSubject(userSubject);
@@ -374,8 +373,7 @@ public class ClientRegistrationService {
 
 private boolean checkCSRFToken(String csrfToken) {
 // CSRF
-Message message = PhaseInterceptorChain.getCurrentMessage();
-HttpServletRequest httpRequest = (HttpServletRequest) 
message.get(AbstractHTTPDestination.HTTP_REQUEST);
+HttpServletRequest httpRequest = mc.getHttpServletRequest();
 String savedToken = CSRFUtils.getCSRFToken(httpRequest, false);
 return !(StringUtils.isEmpty(csrfToken) || 
StringUtils.isEmpty(savedToken)
 || !savedToken.equals(csrfToken));
@@ -467,6 +465,7 @@ public class ClientRegistrationService {
 }
 
 private String getUserName() {
+SecurityContext sc = mc.getSecurityContext();
 if (sc == null || sc.getUserPrincipal() == null) {
 return null;
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/035c4340/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
--
diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
index ef29295..18c7fdd 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
+++ 
b/services/oidc/src/main/java/o

cxf-fediz git commit: Injecting MessageContext instead following feedback from Sergey

2017-04-19 Thread coheigea
Repository: cxf-fediz
Updated Branches:
  refs/heads/master c68e48208 -> 4b9aaf230


Injecting MessageContext instead following feedback from Sergey


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/4b9aaf23
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/4b9aaf23
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/4b9aaf23

Branch: refs/heads/master
Commit: 4b9aaf230c52f4c79660b38d47e6bd339ed6a7c8
Parents: c68e482
Author: Colm O hEigeartaigh 
Authored: Wed Apr 19 11:46:02 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 11:46:02 2017 +0100

--
 .../oidc/clients/ClientRegistrationService.java  | 15 +++
 .../service/oidc/console/UserConsoleService.java | 10 ++
 2 files changed, 13 insertions(+), 12 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/4b9aaf23/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
--
diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
index d00b9cd..6dded2d 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
+++ 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
@@ -58,8 +58,7 @@ import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.Base64UrlUtility;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.fediz.service.oidc.CSRFUtils;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.phase.PhaseInterceptorChain;
+import org.apache.cxf.jaxrs.ext.MessageContext;
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
@@ -71,7 +70,6 @@ import 
org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
 import org.apache.cxf.rs.security.oidc.idp.OidcUserSubject;
 import org.apache.cxf.rt.security.crypto.CryptoUtils;
-import org.apache.cxf.transport.http.AbstractHTTPDestination;
 
 @Path("/")
 public class ClientRegistrationService {
@@ -86,11 +84,11 @@ public class ClientRegistrationService {
 private boolean protectIdTokenWithClientSecret;
 private Map clientScopes;
 
-private SecurityContext sc;
+private MessageContext mc;
 
 @Context
-public void setSecurityContext(SecurityContext securityContext) {
-this.sc = securityContext;
+public void setMessageContext(MessageContext messageContext) {
+this.mc = messageContext;
 }
 
 @GET
@@ -284,6 +282,7 @@ public class ClientRegistrationService {
 Client newClient = new Client(clientId, clientSecret, 
isConfidential, appName);
 
 // User who registered this client
+SecurityContext sc = mc.getSecurityContext();
 String userName = sc.getUserPrincipal().getName();
 UserSubject userSubject = new OidcUserSubject(userName);
 newClient.setResourceOwnerSubject(userSubject);
@@ -353,8 +352,7 @@ public class ClientRegistrationService {
 
 private void checkCSRFToken(String csrfToken) {
 // CSRF
-Message message = PhaseInterceptorChain.getCurrentMessage();
-HttpServletRequest httpRequest = (HttpServletRequest) 
message.get(AbstractHTTPDestination.HTTP_REQUEST);
+HttpServletRequest httpRequest = mc.getHttpServletRequest();
 String savedToken = CSRFUtils.getCSRFToken(httpRequest, false);
 if (StringUtils.isEmpty(csrfToken) || StringUtils.isEmpty(savedToken)
 || !savedToken.equals(csrfToken)) {
@@ -452,6 +450,7 @@ public class ClientRegistrationService {
 }
 
 private String getUserName() {
+SecurityContext sc = mc.getSecurityContext();
 if (sc == null || sc.getUserPrincipal() == null) {
 return null;
 }

http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/4b9aaf23/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
--
diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
index 3d3abb5..cfe9565 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/console/UserConsoleService.java
+++ 
b/services/oidc/src/main/

cxf-fediz git commit: Checkstyle fix

2017-04-19 Thread coheigea
Repository: cxf-fediz
Updated Branches:
  refs/heads/1.3.x-fixes c90528742 -> 8aeeed22a


Checkstyle fix


Project: http://git-wip-us.apache.org/repos/asf/cxf-fediz/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf-fediz/commit/8aeeed22
Tree: http://git-wip-us.apache.org/repos/asf/cxf-fediz/tree/8aeeed22
Diff: http://git-wip-us.apache.org/repos/asf/cxf-fediz/diff/8aeeed22

Branch: refs/heads/1.3.x-fixes
Commit: 8aeeed22aa5b1e9f70c9a0148b037f104aa62ccf
Parents: c905287
Author: Colm O hEigeartaigh 
Authored: Wed Apr 19 10:35:20 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed Apr 19 10:35:20 2017 +0100

--
 .../oidc/clients/ClientRegistrationService.java | 40 
 1 file changed, 24 insertions(+), 16 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf-fediz/blob/8aeeed22/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
--
diff --git 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
index f2860eb..50b38ad 100644
--- 
a/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
+++ 
b/services/oidc/src/main/java/org/apache/cxf/fediz/service/oidc/clients/ClientRegistrationService.java
@@ -256,7 +256,6 @@ public class ClientRegistrationService {
 return null;
 }
 
-//CHECKSTYLE:OFF
 @POST
 @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
 @Produces(MediaType.TEXT_HTML)
@@ -268,22 +267,11 @@ public class ClientRegistrationService {
  @FormParam("client_homeRealm") String 
homeRealm,
  @FormParam("client_csrfToken") String 
csrfToken
 ) {
-// CSRF
-if (!checkCSRFToken(csrfToken)) {
-return invalidRegistrationResponse("Invalid CSRF Token");
+InvalidRegistration invalidRegistration = checkForm(csrfToken, 
appName, appType);
+if (invalidRegistration != null) {
+return Response.ok(invalidRegistration).build();
 }
 
-// Client Name
-if (StringUtils.isEmpty(appName)) {
-return invalidRegistrationResponse("The client name must not be 
empty");
-}
-// Client Type
-if (StringUtils.isEmpty(appType)) {
-return invalidRegistrationResponse("The client type must not be 
empty");
-}
-if (!("confidential".equals(appType) || "public".equals(appType))) {
-return invalidRegistrationResponse("An invalid client type was 
specified: " + appType);
-}
 // Client ID
 String clientId = generateClientId();
 boolean isConfidential = "confidential".equals(appType);
@@ -358,7 +346,27 @@ public class ClientRegistrationService {
 
 return Response.ok(registerNewClient(newClient)).build();
 }
-//CHECKSTYLE:ON
+
+private InvalidRegistration checkForm(String csrfToken, String appName, 
String appType) {
+// CSRF
+if (!checkCSRFToken(csrfToken)) {
+return new InvalidRegistration("Invalid CSRF Token");
+}
+
+// Client Name
+if (StringUtils.isEmpty(appName)) {
+return new InvalidRegistration("The client name must not be 
empty");
+}
+// Client Type
+if (StringUtils.isEmpty(appType)) {
+return new InvalidRegistration("The client type must not be 
empty");
+}
+if (!("confidential".equals(appType) || "public".equals(appType))) {
+return new InvalidRegistration("An invalid client type was 
specified: " + appType);
+}
+
+return null;
+}
 
 private Response invalidRegistrationResponse(String error) {
 return Response.ok(new InvalidRegistration(error)).build();