You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2016/02/05 15:54:57 UTC
[2/2] cxf git commit: Renaming tests
Renaming tests
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/ba7eab43
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/ba7eab43
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/ba7eab43
Branch: refs/heads/master
Commit: ba7eab4318240e8d897b2a98e540f873ae110256
Parents: f560689
Author: Colm O hEigeartaigh <co...@apache.org>
Authored: Fri Feb 5 12:09:56 2016 +0000
Committer: Colm O hEigeartaigh <co...@apache.org>
Committed: Fri Feb 5 14:54:44 2016 +0000
----------------------------------------------------------------------
.../cxf/systest/sts/rest/BasicAuthFilter.java | 117 +++++++++++++++
.../cxf/systest/sts/rest/RESTUnitTest.java | 149 +++++++++++++++++++
.../cxf/systest/sts/rest/STSRESTServer.java | 46 ++++++
.../systest/sts/restunit/BasicAuthFilter.java | 117 ---------------
.../cxf/systest/sts/restunit/RESTUnitTest.java | 149 -------------------
.../cxf/systest/sts/restunit/STSRESTServer.java | 46 ------
.../apache/cxf/systest/sts/rest/cxf-client.xml | 33 ++++
.../cxf/systest/sts/rest/cxf-rest-sts.xml | 142 ++++++++++++++++++
.../cxf/systest/sts/restunit/cxf-client.xml | 33 ----
.../cxf/systest/sts/restunit/cxf-rest-sts.xml | 142 ------------------
10 files changed, 487 insertions(+), 487 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/BasicAuthFilter.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/BasicAuthFilter.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/BasicAuthFilter.java
new file mode 100644
index 0000000..30b0b86
--- /dev/null
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/BasicAuthFilter.java
@@ -0,0 +1,117 @@
+/**
+ * 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.sts.rest;
+
+import java.io.IOException;
+import java.security.Principal;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerRequestFilter;
+import javax.ws.rs.core.Response;
+
+import org.w3c.dom.Document;
+
+import org.apache.cxf.configuration.security.AuthorizationPolicy;
+import org.apache.cxf.helpers.DOMUtils;
+import org.apache.cxf.jaxrs.utils.ExceptionUtils;
+import org.apache.cxf.jaxrs.utils.JAXRSUtils;
+import org.apache.cxf.message.Message;
+import org.apache.cxf.security.SecurityContext;
+import org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl;
+import org.apache.wss4j.dom.WSConstants;
+import org.apache.wss4j.dom.handler.RequestData;
+import org.apache.wss4j.dom.message.token.UsernameToken;
+import org.apache.wss4j.dom.validate.Credential;
+import org.apache.wss4j.dom.validate.UsernameTokenValidator;
+
+/**
+ * A simple filter to validate a Basic Auth username/password via a CallbackHandler
+ */
+public class BasicAuthFilter implements ContainerRequestFilter {
+
+ private CallbackHandler callbackHandler;
+
+ public void filter(ContainerRequestContext requestContext) throws IOException {
+ Message message = JAXRSUtils.getCurrentMessage();
+ AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
+
+ if (policy == null || policy.getUserName() == null || policy.getPassword() == null) {
+ requestContext.abortWith(
+ Response.status(401).header("WWW-Authenticate", "Basic realm=\"IdP\"").build());
+ }
+
+ try {
+ UsernameToken token = convertPolicyToToken(policy);
+ Credential credential = new Credential();
+ credential.setUsernametoken(token);
+
+ RequestData data = new RequestData();
+ data.setMsgContext(message);
+ data.setCallbackHandler(callbackHandler);
+ UsernameTokenValidator validator = new UsernameTokenValidator();
+ credential = validator.validate(credential, data);
+
+ // Create a Principal/SecurityContext
+ Principal p = null;
+ if (credential != null && credential.getPrincipal() != null) {
+ p = credential.getPrincipal();
+ } else {
+ p = new WSUsernameTokenPrincipalImpl(policy.getUserName(), false);
+ ((WSUsernameTokenPrincipalImpl)p).setPassword(policy.getPassword());
+ }
+ message.put(SecurityContext.class, createSecurityContext(p));
+ } catch (Exception ex) {
+ throw ExceptionUtils.toInternalServerErrorException(ex, null);
+ }
+ }
+
+ protected UsernameToken convertPolicyToToken(AuthorizationPolicy policy)
+ throws Exception {
+
+ Document doc = DOMUtils.createDocument();
+ UsernameToken token = new UsernameToken(false, doc,
+ WSConstants.PASSWORD_TEXT);
+ token.setName(policy.getUserName());
+ token.setPassword(policy.getPassword());
+ return token;
+ }
+
+ protected SecurityContext createSecurityContext(final Principal p) {
+ return new SecurityContext() {
+
+ public Principal getUserPrincipal() {
+ return p;
+ }
+
+ public boolean isUserInRole(String arg0) {
+ return false;
+ }
+ };
+ }
+
+ public CallbackHandler getCallbackHandler() {
+ return callbackHandler;
+ }
+
+ public void setCallbackHandler(CallbackHandler callbackHandler) {
+ this.callbackHandler = callbackHandler;
+ }
+
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/RESTUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/RESTUnitTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/RESTUnitTest.java
new file mode 100644
index 0000000..0668e39
--- /dev/null
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/RESTUnitTest.java
@@ -0,0 +1,149 @@
+/**
+ * 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.sts.rest;
+
+import java.net.URL;
+import java.util.List;
+
+import javax.security.auth.callback.CallbackHandler;
+import javax.ws.rs.core.Response;
+import javax.xml.bind.JAXBElement;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.jaxrs.client.WebClient;
+import org.apache.cxf.systest.sts.common.SecurityTestUtil;
+import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
+import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseType;
+import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType;
+import org.apache.wss4j.common.crypto.Crypto;
+import org.apache.wss4j.common.crypto.CryptoFactory;
+import org.apache.wss4j.common.saml.SamlAssertionWrapper;
+import org.apache.wss4j.dom.WSDocInfo;
+import org.apache.wss4j.dom.engine.WSSecurityEngineResult;
+import org.apache.wss4j.dom.handler.RequestData;
+import org.apache.wss4j.dom.processor.Processor;
+import org.apache.wss4j.dom.processor.SAMLTokenProcessor;
+import org.junit.BeforeClass;
+
+/**
+ * Some unit tests for the CXF STSClient Issue Binding.
+ */
+public class RESTUnitTest extends AbstractBusClientServerTestBase {
+
+ static final String STSPORT = allocatePort(STSRESTServer.class);
+
+ @BeforeClass
+ public static void startServers() throws Exception {
+ assertTrue(
+ "Server failed to launch",
+ // run the server in the same process
+ // set this to false to fork
+ launchServer(STSRESTServer.class, true)
+ );
+ }
+
+ @org.junit.AfterClass
+ public static void cleanup() throws Exception {
+ SecurityTestUtil.cleanup();
+ stopAllServers();
+ }
+
+ @org.junit.Test
+ public void testIssueSAML2Token() throws Exception {
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = RESTUnitTest.class.getResource("cxf-client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ String address = "https://localhost:" + STSPORT + "/SecurityTokenService/token";
+ WebClient client = WebClient.create(address, "alice", "clarinet", busFile.toString());
+
+ client.type("application/xml").accept("application/xml");
+ client.path("saml2.0");
+
+ Response response = client.get();
+ RequestSecurityTokenResponseType securityResponse =
+ response.readEntity(RequestSecurityTokenResponseType.class);
+
+ RequestedSecurityTokenType requestedSecurityToken = null;
+ for (Object obj : securityResponse.getAny()) {
+ if (obj instanceof JAXBElement<?>) {
+ JAXBElement<?> jaxbElement = (JAXBElement<?>)obj;
+ if ("RequestedSecurityToken".equals(jaxbElement.getName().getLocalPart())) {
+ requestedSecurityToken = (RequestedSecurityTokenType)jaxbElement.getValue();
+ break;
+ }
+ }
+ }
+ assertNotNull(requestedSecurityToken);
+
+ // Process the token
+ List<WSSecurityEngineResult> results = processToken(requestedSecurityToken);
+
+ assertTrue(results != null && results.size() == 1);
+ SamlAssertionWrapper assertion =
+ (SamlAssertionWrapper)results.get(0).get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
+ assertTrue(assertion != null);
+ assertTrue(assertion.getSaml2() != null && assertion.getSaml1() == null);
+ assertTrue(assertion.isSigned());
+
+ bus.shutdown(true);
+ }
+
+ @org.junit.Test
+ public void testIssueJWTToken() throws Exception {
+ SpringBusFactory bf = new SpringBusFactory();
+ URL busFile = RESTUnitTest.class.getResource("cxf-client.xml");
+
+ Bus bus = bf.createBus(busFile.toString());
+ SpringBusFactory.setDefaultBus(bus);
+ SpringBusFactory.setThreadDefaultBus(bus);
+
+ String address = "https://localhost:" + STSPORT + "/SecurityTokenService/token";
+ WebClient client = WebClient.create(address, "alice", "clarinet", busFile.toString());
+
+ client.type("application/json").accept("application/json");
+ client.path("jwt");
+
+ client.get();
+ }
+
+ private List<WSSecurityEngineResult> processToken(RequestedSecurityTokenType securityResponse)
+ throws Exception {
+ RequestData requestData = new RequestData();
+ requestData.setDisableBSPEnforcement(true);
+ CallbackHandler callbackHandler = new org.apache.cxf.systest.sts.common.CommonCallbackHandler();
+ requestData.setCallbackHandler(callbackHandler);
+ Crypto crypto = CryptoFactory.getInstance("serviceKeystore.properties");
+ requestData.setDecCrypto(crypto);
+ requestData.setSigVerCrypto(crypto);
+
+ Processor processor = new SAMLTokenProcessor();
+ Element securityTokenElem = (Element)securityResponse.getAny();
+ return processor.handleToken(
+ securityTokenElem, requestData, new WSDocInfo(securityTokenElem.getOwnerDocument())
+ );
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTServer.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTServer.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTServer.java
new file mode 100644
index 0000000..aab419a
--- /dev/null
+++ b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/rest/STSRESTServer.java
@@ -0,0 +1,46 @@
+/**
+ * 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.sts.rest;
+
+import java.net.URL;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.BusFactory;
+import org.apache.cxf.bus.spring.SpringBusFactory;
+import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
+
+public class STSRESTServer extends AbstractBusTestServerBase {
+
+ public STSRESTServer() {
+
+ }
+
+ protected void run() {
+ URL busFile = STSRESTServer.class.getResource("cxf-rest-sts.xml");
+ Bus busLocal = new SpringBusFactory().createBus(busFile);
+ BusFactory.setDefaultBus(busLocal);
+ setBus(busLocal);
+
+ try {
+ new STSRESTServer();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/BasicAuthFilter.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/BasicAuthFilter.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/BasicAuthFilter.java
deleted file mode 100644
index 5c5616e..0000000
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/BasicAuthFilter.java
+++ /dev/null
@@ -1,117 +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.systest.sts.restunit;
-
-import java.io.IOException;
-import java.security.Principal;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.core.Response;
-
-import org.w3c.dom.Document;
-
-import org.apache.cxf.configuration.security.AuthorizationPolicy;
-import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxrs.utils.ExceptionUtils;
-import org.apache.cxf.jaxrs.utils.JAXRSUtils;
-import org.apache.cxf.message.Message;
-import org.apache.cxf.security.SecurityContext;
-import org.apache.wss4j.common.principal.WSUsernameTokenPrincipalImpl;
-import org.apache.wss4j.dom.WSConstants;
-import org.apache.wss4j.dom.handler.RequestData;
-import org.apache.wss4j.dom.message.token.UsernameToken;
-import org.apache.wss4j.dom.validate.Credential;
-import org.apache.wss4j.dom.validate.UsernameTokenValidator;
-
-/**
- * A simple filter to validate a Basic Auth username/password via a CallbackHandler
- */
-public class BasicAuthFilter implements ContainerRequestFilter {
-
- private CallbackHandler callbackHandler;
-
- public void filter(ContainerRequestContext requestContext) throws IOException {
- Message message = JAXRSUtils.getCurrentMessage();
- AuthorizationPolicy policy = message.get(AuthorizationPolicy.class);
-
- if (policy == null || policy.getUserName() == null || policy.getPassword() == null) {
- requestContext.abortWith(
- Response.status(401).header("WWW-Authenticate", "Basic realm=\"IdP\"").build());
- }
-
- try {
- UsernameToken token = convertPolicyToToken(policy);
- Credential credential = new Credential();
- credential.setUsernametoken(token);
-
- RequestData data = new RequestData();
- data.setMsgContext(message);
- data.setCallbackHandler(callbackHandler);
- UsernameTokenValidator validator = new UsernameTokenValidator();
- credential = validator.validate(credential, data);
-
- // Create a Principal/SecurityContext
- Principal p = null;
- if (credential != null && credential.getPrincipal() != null) {
- p = credential.getPrincipal();
- } else {
- p = new WSUsernameTokenPrincipalImpl(policy.getUserName(), false);
- ((WSUsernameTokenPrincipalImpl)p).setPassword(policy.getPassword());
- }
- message.put(SecurityContext.class, createSecurityContext(p));
- } catch (Exception ex) {
- throw ExceptionUtils.toInternalServerErrorException(ex, null);
- }
- }
-
- protected UsernameToken convertPolicyToToken(AuthorizationPolicy policy)
- throws Exception {
-
- Document doc = DOMUtils.createDocument();
- UsernameToken token = new UsernameToken(false, doc,
- WSConstants.PASSWORD_TEXT);
- token.setName(policy.getUserName());
- token.setPassword(policy.getPassword());
- return token;
- }
-
- protected SecurityContext createSecurityContext(final Principal p) {
- return new SecurityContext() {
-
- public Principal getUserPrincipal() {
- return p;
- }
-
- public boolean isUserInRole(String arg0) {
- return false;
- }
- };
- }
-
- public CallbackHandler getCallbackHandler() {
- return callbackHandler;
- }
-
- public void setCallbackHandler(CallbackHandler callbackHandler) {
- this.callbackHandler = callbackHandler;
- }
-
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/RESTUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/RESTUnitTest.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/RESTUnitTest.java
deleted file mode 100644
index 0164017..0000000
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/RESTUnitTest.java
+++ /dev/null
@@ -1,149 +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.systest.sts.restunit;
-
-import java.net.URL;
-import java.util.List;
-
-import javax.security.auth.callback.CallbackHandler;
-import javax.ws.rs.core.Response;
-import javax.xml.bind.JAXBElement;
-
-import org.w3c.dom.Element;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.jaxrs.client.WebClient;
-import org.apache.cxf.systest.sts.common.SecurityTestUtil;
-import org.apache.cxf.testutil.common.AbstractBusClientServerTestBase;
-import org.apache.cxf.ws.security.sts.provider.model.RequestSecurityTokenResponseType;
-import org.apache.cxf.ws.security.sts.provider.model.RequestedSecurityTokenType;
-import org.apache.wss4j.common.crypto.Crypto;
-import org.apache.wss4j.common.crypto.CryptoFactory;
-import org.apache.wss4j.common.saml.SamlAssertionWrapper;
-import org.apache.wss4j.dom.WSDocInfo;
-import org.apache.wss4j.dom.engine.WSSecurityEngineResult;
-import org.apache.wss4j.dom.handler.RequestData;
-import org.apache.wss4j.dom.processor.Processor;
-import org.apache.wss4j.dom.processor.SAMLTokenProcessor;
-import org.junit.BeforeClass;
-
-/**
- * Some unit tests for the CXF STSClient Issue Binding.
- */
-public class RESTUnitTest extends AbstractBusClientServerTestBase {
-
- static final String STSPORT = allocatePort(STSRESTServer.class);
-
- @BeforeClass
- public static void startServers() throws Exception {
- assertTrue(
- "Server failed to launch",
- // run the server in the same process
- // set this to false to fork
- launchServer(STSRESTServer.class, true)
- );
- }
-
- @org.junit.AfterClass
- public static void cleanup() throws Exception {
- SecurityTestUtil.cleanup();
- stopAllServers();
- }
-
- @org.junit.Test
- public void testIssueSAML2Token() throws Exception {
- SpringBusFactory bf = new SpringBusFactory();
- URL busFile = RESTUnitTest.class.getResource("cxf-client.xml");
-
- Bus bus = bf.createBus(busFile.toString());
- SpringBusFactory.setDefaultBus(bus);
- SpringBusFactory.setThreadDefaultBus(bus);
-
- String address = "https://localhost:" + STSPORT + "/SecurityTokenService/token";
- WebClient client = WebClient.create(address, "alice", "clarinet", busFile.toString());
-
- client.type("application/xml").accept("application/xml");
- client.path("saml2.0");
-
- Response response = client.get();
- RequestSecurityTokenResponseType securityResponse =
- response.readEntity(RequestSecurityTokenResponseType.class);
-
- RequestedSecurityTokenType requestedSecurityToken = null;
- for (Object obj : securityResponse.getAny()) {
- if (obj instanceof JAXBElement<?>) {
- JAXBElement<?> jaxbElement = (JAXBElement<?>)obj;
- if ("RequestedSecurityToken".equals(jaxbElement.getName().getLocalPart())) {
- requestedSecurityToken = (RequestedSecurityTokenType)jaxbElement.getValue();
- break;
- }
- }
- }
- assertNotNull(requestedSecurityToken);
-
- // Process the token
- List<WSSecurityEngineResult> results = processToken(requestedSecurityToken);
-
- assertTrue(results != null && results.size() == 1);
- SamlAssertionWrapper assertion =
- (SamlAssertionWrapper)results.get(0).get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
- assertTrue(assertion != null);
- assertTrue(assertion.getSaml2() != null && assertion.getSaml1() == null);
- assertTrue(assertion.isSigned());
-
- bus.shutdown(true);
- }
-
- @org.junit.Test
- public void testIssueJWTToken() throws Exception {
- SpringBusFactory bf = new SpringBusFactory();
- URL busFile = RESTUnitTest.class.getResource("cxf-client.xml");
-
- Bus bus = bf.createBus(busFile.toString());
- SpringBusFactory.setDefaultBus(bus);
- SpringBusFactory.setThreadDefaultBus(bus);
-
- String address = "https://localhost:" + STSPORT + "/SecurityTokenService/token";
- WebClient client = WebClient.create(address, "alice", "clarinet", busFile.toString());
-
- client.type("application/json").accept("application/json");
- client.path("jwt");
-
- client.get();
- }
-
- private List<WSSecurityEngineResult> processToken(RequestedSecurityTokenType securityResponse)
- throws Exception {
- RequestData requestData = new RequestData();
- requestData.setDisableBSPEnforcement(true);
- CallbackHandler callbackHandler = new org.apache.cxf.systest.sts.common.CommonCallbackHandler();
- requestData.setCallbackHandler(callbackHandler);
- Crypto crypto = CryptoFactory.getInstance("serviceKeystore.properties");
- requestData.setDecCrypto(crypto);
- requestData.setSigVerCrypto(crypto);
-
- Processor processor = new SAMLTokenProcessor();
- Element securityTokenElem = (Element)securityResponse.getAny();
- return processor.handleToken(
- securityTokenElem, requestData, new WSDocInfo(securityTokenElem.getOwnerDocument())
- );
- }
-
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/STSRESTServer.java
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/STSRESTServer.java b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/STSRESTServer.java
deleted file mode 100644
index 1c3a72d..0000000
--- a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/restunit/STSRESTServer.java
+++ /dev/null
@@ -1,46 +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.systest.sts.restunit;
-
-import java.net.URL;
-
-import org.apache.cxf.Bus;
-import org.apache.cxf.BusFactory;
-import org.apache.cxf.bus.spring.SpringBusFactory;
-import org.apache.cxf.testutil.common.AbstractBusTestServerBase;
-
-public class STSRESTServer extends AbstractBusTestServerBase {
-
- public STSRESTServer() {
-
- }
-
- protected void run() {
- URL busFile = STSRESTServer.class.getResource("cxf-rest-sts.xml");
- Bus busLocal = new SpringBusFactory().createBus(busFile);
- BusFactory.setDefaultBus(busLocal);
- setBus(busLocal);
-
- try {
- new STSRESTServer();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-client.xml
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-client.xml b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-client.xml
new file mode 100644
index 0000000..892e5a5
--- /dev/null
+++ b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-client.xml
@@ -0,0 +1,33 @@
+<?xml version="1.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd">
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
+ <http:conduit name="https://localhost:.*">
+ <http:tlsClientParameters disableCNCheck="true">
+ <sec:trustManagers>
+ <sec:keyStore type="jks" password="cspass" resource="clientstore.jks"/>
+ </sec:trustManagers>
+ </http:tlsClientParameters>
+ </http:conduit>
+</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-rest-sts.xml
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-rest-sts.xml b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-rest-sts.xml
new file mode 100644
index 0000000..b61e481
--- /dev/null
+++ b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/rest/cxf-rest-sts.xml
@@ -0,0 +1,142 @@
+<?xml version="1.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.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:test="http://apache.org/hello_world_soap_http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/transports/http-jetty/conf
iguration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
+
+ <import resource="classpath:META-INF/cxf/cxf.xml"/>
+
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
+ <cxf:bus>
+ <cxf:features>
+ <cxf:logging/>
+ </cxf:features>
+ </cxf:bus>
+
+ <bean id="hokDelegationHandler" class="org.apache.cxf.sts.token.delegation.HOKDelegationHandler"/>
+ <bean id="utDelegationHandler" class="org.apache.cxf.sts.token.delegation.UsernameTokenDelegationHandler"/>
+
+ <util:list id="delegationHandlers">
+ <ref bean="hokDelegationHandler"/>
+ <ref bean="utDelegationHandler"/>
+ </util:list>
+
+ <bean id="transportIssueDelegate" class="org.apache.cxf.sts.operation.TokenIssueOperation">
+ <property name="tokenProviders" ref="transportTokenProviders"/>
+ <property name="tokenValidators" ref="transportTokenValidators"/>
+ <property name="services" ref="transportService"/>
+ <property name="stsProperties" ref="transportSTSProperties"/>
+ <property name="delegationHandlers" ref="delegationHandlers"/>
+ <property name="claimsManager" ref="claimsManager"/>
+ </bean>
+ <bean id="transportValidateDelegate" class="org.apache.cxf.sts.operation.TokenValidateOperation">
+ <property name="tokenValidators" ref="transportTokenValidators"/>
+ <property name="stsProperties" ref="transportSTSProperties"/>
+ </bean>
+ <bean id="transportUTTokenValidator" class="org.apache.cxf.sts.token.validator.UsernameTokenValidator">
+ </bean>
+ <util:list id="transportTokenValidators">
+ <ref bean="transportSamlTokenValidator"/>
+ <ref bean="transportUTTokenValidator"/>
+ </util:list>
+ <util:list id="transportTokenProviders">
+ <ref bean="transportSamlTokenProvider"/>
+ <ref bean="transportJWTTokenProvider"/>
+ </util:list>
+ <bean id="transportSamlTokenValidator" class="org.apache.cxf.sts.token.validator.SAMLTokenValidator">
+ </bean>
+ <bean id="transportSamlTokenProvider" class="org.apache.cxf.sts.token.provider.SAMLTokenProvider">
+ </bean>
+ <bean id="transportJWTTokenProvider" class="org.apache.cxf.sts.token.provider.jwt.JWTTokenProvider">
+ </bean>
+ <bean id="transportSTSProviderBean" class="org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider">
+ <property name="issueOperation" ref="transportIssueDelegate"/>
+ <property name="validateOperation" ref="transportValidateDelegate"/>
+ </bean>
+ <bean id="transportService" class="org.apache.cxf.sts.service.StaticService">
+ <property name="endpoints" ref="transportEndpoints"/>
+ </bean>
+ <util:list id="transportEndpoints">
+ <value>https://localhost:(\d)*/doubleit/services/doubleittransport.*
+ </value>
+ </util:list>
+ <bean id="transportSTSProperties" class="org.apache.cxf.sts.StaticSTSProperties">
+ <property name="signaturePropertiesFile" value="stsKeystore.properties"/>
+ <property name="signatureUsername" value="mystskey"/>
+ <property name="callbackHandlerClass" value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
+ <property name="encryptionPropertiesFile" value="stsKeystore.properties"/>
+ <property name="issuer" value="DoubleItSTSIssuer"/>
+ <property name="encryptionUsername" value="myservicekey"/>
+ </bean>
+
+ <bean id="claimsManager" class="org.apache.cxf.sts.claims.ClaimsManager">
+ <property name="claimHandlers" ref="customClaimsHandler"/>
+ </bean>
+ <bean id="customClaimsHandler" class="org.apache.cxf.systest.sts.deployment.CustomClaimsHandler">
+ </bean>
+
+ <bean id="restSTS" class="org.apache.cxf.sts.rest.RESTSecurityTokenServiceImpl">
+ <property name="issueSingleOperation" ref="transportIssueDelegate" />
+ <property name="validateOperation" ref="transportValidateDelegate" />
+ </bean>
+
+ <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
+ <property name="depthProperties">
+ <bean class="org.apache.cxf.staxutils.DocumentDepthProperties">
+ <property name="innerElementCountThreshold" value="500" />
+ </bean>
+ </property>
+ </bean>
+
+ <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
+
+ <bean id="callbackHandler" class="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
+ <bean id="basicAuthFilter" class="org.apache.cxf.systest.sts.rest.BasicAuthFilter">
+ <property name="callbackHandler" ref="callbackHandler"/>
+ </bean>
+
+ <jaxrs:server id="stsRESTService"
+ depends-on="ClientAuthHttpsSettings"
+ address="https://localhost:${testutil.ports.STSRESTServer}/SecurityTokenService">
+ <jaxrs:serviceBeans>
+ <ref bean="restSTS" />
+ </jaxrs:serviceBeans>
+ <jaxrs:providers>
+ <ref bean="jsonProvider" />
+ <ref bean="basicAuthFilter"/>
+ </jaxrs:providers>
+ <jaxrs:extensionMappings>
+ <entry key="json" value="application/json;charset=UTF-8" />
+ <entry key="xml" value="application/xml;charset=UTF-8" />
+ </jaxrs:extensionMappings>
+ </jaxrs:server>
+
+ <httpj:engine-factory id="ClientAuthHttpsSettings" bus="cxf">
+ <httpj:engine port="${testutil.ports.STSRESTServer}">
+ <httpj:tlsServerParameters>
+ <sec:keyManagers keyPassword="skpass">
+ <sec:keyStore type="jks" password="sspass" resource="servicestore.jks"/>
+ </sec:keyManagers>
+ <sec:trustManagers>
+ <sec:keyStore type="jks" password="stsspass" resource="stsstore.jks"/>
+ </sec:trustManagers>
+ <sec:clientAuthentication want="false" required="false"/>
+ </httpj:tlsServerParameters>
+ </httpj:engine>
+ </httpj:engine-factory>
+</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-client.xml
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-client.xml b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-client.xml
deleted file mode 100644
index 892e5a5..0000000
--- a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-client.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:cxf="http://cxf.apache.org/core" xmlns:http="http://cxf.apache.org/transports/http/configuration" xmlns:sec="http://cxf.apache.org/configuration/security" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd">
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- </cxf:features>
- </cxf:bus>
- <http:conduit name="https://localhost:.*">
- <http:tlsClientParameters disableCNCheck="true">
- <sec:trustManagers>
- <sec:keyStore type="jks" password="cspass" resource="clientstore.jks"/>
- </sec:trustManagers>
- </http:tlsClientParameters>
- </http:conduit>
-</beans>
http://git-wip-us.apache.org/repos/asf/cxf/blob/ba7eab43/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-rest-sts.xml
----------------------------------------------------------------------
diff --git a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-rest-sts.xml b/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-rest-sts.xml
deleted file mode 100644
index 9565d30..0000000
--- a/services/sts/systests/basic/src/test/resources/org/apache/cxf/systest/sts/restunit/cxf-rest-sts.xml
+++ /dev/null
@@ -1,142 +0,0 @@
-<?xml version="1.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.
--->
-<beans xmlns="http://www.springframework.org/schema/beans" xmlns:cxf="http://cxf.apache.org/core" xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:sec="http://cxf.apache.org/configuration/security" xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration" xmlns:test="http://apache.org/hello_world_soap_http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xmlns:jaxrs="http://cxf.apache.org/jaxrs" xsi:schemaLocation=" http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/transports/http-jetty/conf
iguration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
-
- <import resource="classpath:META-INF/cxf/cxf.xml"/>
-
- <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
- <cxf:bus>
- <cxf:features>
- <cxf:logging/>
- </cxf:features>
- </cxf:bus>
-
- <bean id="hokDelegationHandler" class="org.apache.cxf.sts.token.delegation.HOKDelegationHandler"/>
- <bean id="utDelegationHandler" class="org.apache.cxf.sts.token.delegation.UsernameTokenDelegationHandler"/>
-
- <util:list id="delegationHandlers">
- <ref bean="hokDelegationHandler"/>
- <ref bean="utDelegationHandler"/>
- </util:list>
-
- <bean id="transportIssueDelegate" class="org.apache.cxf.sts.operation.TokenIssueOperation">
- <property name="tokenProviders" ref="transportTokenProviders"/>
- <property name="tokenValidators" ref="transportTokenValidators"/>
- <property name="services" ref="transportService"/>
- <property name="stsProperties" ref="transportSTSProperties"/>
- <property name="delegationHandlers" ref="delegationHandlers"/>
- <property name="claimsManager" ref="claimsManager"/>
- </bean>
- <bean id="transportValidateDelegate" class="org.apache.cxf.sts.operation.TokenValidateOperation">
- <property name="tokenValidators" ref="transportTokenValidators"/>
- <property name="stsProperties" ref="transportSTSProperties"/>
- </bean>
- <bean id="transportUTTokenValidator" class="org.apache.cxf.sts.token.validator.UsernameTokenValidator">
- </bean>
- <util:list id="transportTokenValidators">
- <ref bean="transportSamlTokenValidator"/>
- <ref bean="transportUTTokenValidator"/>
- </util:list>
- <util:list id="transportTokenProviders">
- <ref bean="transportSamlTokenProvider"/>
- <ref bean="transportJWTTokenProvider"/>
- </util:list>
- <bean id="transportSamlTokenValidator" class="org.apache.cxf.sts.token.validator.SAMLTokenValidator">
- </bean>
- <bean id="transportSamlTokenProvider" class="org.apache.cxf.sts.token.provider.SAMLTokenProvider">
- </bean>
- <bean id="transportJWTTokenProvider" class="org.apache.cxf.sts.token.provider.jwt.JWTTokenProvider">
- </bean>
- <bean id="transportSTSProviderBean" class="org.apache.cxf.ws.security.sts.provider.SecurityTokenServiceProvider">
- <property name="issueOperation" ref="transportIssueDelegate"/>
- <property name="validateOperation" ref="transportValidateDelegate"/>
- </bean>
- <bean id="transportService" class="org.apache.cxf.sts.service.StaticService">
- <property name="endpoints" ref="transportEndpoints"/>
- </bean>
- <util:list id="transportEndpoints">
- <value>https://localhost:(\d)*/doubleit/services/doubleittransport.*
- </value>
- </util:list>
- <bean id="transportSTSProperties" class="org.apache.cxf.sts.StaticSTSProperties">
- <property name="signaturePropertiesFile" value="stsKeystore.properties"/>
- <property name="signatureUsername" value="mystskey"/>
- <property name="callbackHandlerClass" value="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
- <property name="encryptionPropertiesFile" value="stsKeystore.properties"/>
- <property name="issuer" value="DoubleItSTSIssuer"/>
- <property name="encryptionUsername" value="myservicekey"/>
- </bean>
-
- <bean id="claimsManager" class="org.apache.cxf.sts.claims.ClaimsManager">
- <property name="claimHandlers" ref="customClaimsHandler"/>
- </bean>
- <bean id="customClaimsHandler" class="org.apache.cxf.systest.sts.deployment.CustomClaimsHandler">
- </bean>
-
- <bean id="restSTS" class="org.apache.cxf.sts.rest.RESTSecurityTokenServiceImpl">
- <property name="issueSingleOperation" ref="transportIssueDelegate" />
- <property name="validateOperation" ref="transportValidateDelegate" />
- </bean>
-
- <bean id="jaxbProvider" class="org.apache.cxf.jaxrs.provider.JAXBElementProvider">
- <property name="depthProperties">
- <bean class="org.apache.cxf.staxutils.DocumentDepthProperties">
- <property name="innerElementCountThreshold" value="500" />
- </bean>
- </property>
- </bean>
-
- <bean id="jsonProvider" class="com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider" />
-
- <bean id="callbackHandler" class="org.apache.cxf.systest.sts.common.CommonCallbackHandler"/>
- <bean id="basicAuthFilter" class="org.apache.cxf.systest.sts.restunit.BasicAuthFilter">
- <property name="callbackHandler" ref="callbackHandler"/>
- </bean>
-
- <jaxrs:server id="stsRESTService"
- depends-on="ClientAuthHttpsSettings"
- address="https://localhost:${testutil.ports.STSRESTServer}/SecurityTokenService">
- <jaxrs:serviceBeans>
- <ref bean="restSTS" />
- </jaxrs:serviceBeans>
- <jaxrs:providers>
- <ref bean="jsonProvider" />
- <ref bean="basicAuthFilter"/>
- </jaxrs:providers>
- <jaxrs:extensionMappings>
- <entry key="json" value="application/json;charset=UTF-8" />
- <entry key="xml" value="application/xml;charset=UTF-8" />
- </jaxrs:extensionMappings>
- </jaxrs:server>
-
- <httpj:engine-factory id="ClientAuthHttpsSettings" bus="cxf">
- <httpj:engine port="${testutil.ports.STSRESTServer}">
- <httpj:tlsServerParameters>
- <sec:keyManagers keyPassword="skpass">
- <sec:keyStore type="jks" password="sspass" resource="servicestore.jks"/>
- </sec:keyManagers>
- <sec:trustManagers>
- <sec:keyStore type="jks" password="stsspass" resource="stsstore.jks"/>
- </sec:trustManagers>
- <sec:clientAuthentication want="false" required="false"/>
- </httpj:tlsServerParameters>
- </httpj:engine>
- </httpj:engine-factory>
-</beans>