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/02 17:54:17 UTC
[3/4] cxf git commit: Finished removing the WebServiceContext from
the STS
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java
index 510c7b4..273b7a7 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueOnbehalfofUnitTest.java
@@ -35,7 +35,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -159,11 +158,10 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -231,11 +229,10 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -301,13 +298,12 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
// This should fail as the default DelegationHandler does not allow HolderOfKey
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected as HolderOfKey is not allowed by default");
} catch (STSException ex) {
// expected
@@ -317,7 +313,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
issueOperation.setDelegationHandlers(Collections.singletonList(delegationHandler));
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -383,13 +379,12 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
// This should fail as the default DelegationHandler does not allow HolderOfKey
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected as HolderOfKey is not allowed by default");
} catch (STSException ex) {
// expected
@@ -399,7 +394,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
issueOperation.setDelegationHandlers(Collections.singletonList(delegationHandler));
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -465,13 +460,12 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
// This should fail as the default DelegationHandler does not allow HolderOfKey
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected as HolderOfKey is not allowed by default");
} catch (STSException ex) {
// expected
@@ -481,7 +475,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
issueOperation.setDelegationHandlers(Collections.singletonList(delegationHandler));
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -547,13 +541,12 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
// This should fail as the default DelegationHandler does not allow HolderOfKey
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected as HolderOfKey is not allowed by default");
} catch (STSException ex) {
// expected
@@ -563,7 +556,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
issueOperation.setDelegationHandlers(Collections.singletonList(delegationHandler));
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -633,15 +626,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token - this should work
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy2"));
// This should fail
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected due to AudienceRestriction");
} catch (STSException ex) {
// expected
@@ -712,15 +704,14 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token - this should work
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy2"));
// This should fail
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected due to AudienceRestriction");
} catch (STSException ex) {
// expected
@@ -784,13 +775,12 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
// This should fail as the default DelegationHandler does not allow UsernameTokens
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected as UsernameTokens are not accepted for OnBehalfOf by default");
} catch (STSException ex) {
// expected
@@ -800,7 +790,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
issueOperation.setDelegationHandlers(Collections.singletonList(delegationHandler));
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -863,14 +853,13 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
TokenDelegationHandler delegationHandler = new UsernameTokenDelegationHandler();
issueOperation.setDelegationHandlers(Collections.singletonList(delegationHandler));
// Issue a token - this will fail as the UsernameToken validation fails
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected as no principal is available to create SAML assertion");
} catch (STSException ex) {
// expected
@@ -950,12 +939,11 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token - this will fail as the tokenProvider doesn't understand how to handle
// realm "B"
//try {
- // issueOperation.issue(request, webServiceContext);
+ // issueOperation.issue(request, msgCtx);
//} catch (STSException ex) {
// // expected
//}
@@ -963,7 +951,7 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
samlTokenProvider.setRealmMap(realms);
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponseList =
response.getRequestSecurityTokenResponse();
@@ -1052,15 +1040,15 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context with user 'bob'
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("bob");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("bob"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -1174,15 +1162,15 @@ public class IssueOnbehalfofUnitTest extends org.junit.Assert {
// Mock up message context with user 'bob'
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("bob");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("bob"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java
index ee5a6bb..ef6b190 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSCTUnitTest.java
@@ -31,7 +31,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -120,15 +119,15 @@ public class IssueSCTUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -198,15 +197,15 @@ public class IssueSCTUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -272,15 +271,15 @@ public class IssueSCTUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
index 459a78f..411ed13 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlClaimsUnitTest.java
@@ -35,7 +35,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.rt.security.claims.Claim;
@@ -128,10 +127,11 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
request.getAny().add(secondaryParameters);
request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy"));
- WebServiceContextImpl webServiceContext = setupMessageContext();
+ Map<String, Object> msgCtx = setupMessageContext();
List<RequestSecurityTokenResponseType> securityTokenResponse = issueToken(issueOperation, request,
- webServiceContext);
+ new CustomTokenPrincipal("alice"),
+ msgCtx);
// Test the generated token.
Element assertion = null;
@@ -188,10 +188,11 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
request.getAny().add(secondaryParameters);
request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy"));
- WebServiceContextImpl webServiceContext = setupMessageContext();
+ Map<String, Object> msgCtx = setupMessageContext();
List<RequestSecurityTokenResponseType> securityTokenResponse = issueToken(issueOperation, request,
- webServiceContext);
+ new CustomTokenPrincipal("alice"),
+ msgCtx);
// Test the generated token.
Element assertion = null;
@@ -251,11 +252,11 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy"));
// Mock up message context
- WebServiceContextImpl webServiceContext = setupMessageContext();
+ Map<String, Object> msgCtx = setupMessageContext();
// Issue a token
List<RequestSecurityTokenResponseType> securityTokenResponse = issueToken(issueOperation,
- request, webServiceContext);
+ request, new CustomTokenPrincipal("alice"), msgCtx);
// Test the generated token.
Element assertion = null;
@@ -316,10 +317,10 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
request.getAny().add(secondaryParameters);
request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy"));
- WebServiceContextImpl webServiceContext = setupMessageContext();
+ Map<String, Object> msgCtx = setupMessageContext();
try {
- issueToken(issueOperation, request, webServiceContext);
+ issueToken(issueOperation, request, new CustomTokenPrincipal("alice"), msgCtx);
fail("Failure expected on an unknown non-optional claims type");
} catch (Exception ex) {
// expected
@@ -333,9 +334,9 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
* @return
*/
private List<RequestSecurityTokenResponseType> issueToken(TokenIssueOperation issueOperation,
- RequestSecurityTokenType request, WebServiceContextImpl webServiceContext) {
+ RequestSecurityTokenType request, Principal principal, Map<String, Object> msgCtx) {
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -345,14 +346,14 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
/**
* @return
*/
- private WebServiceContextImpl setupMessageContext() {
+ private Map<String, Object> setupMessageContext() {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put(
SecurityContext.class.getName(),
createSecurityContext(new CustomTokenPrincipal("alice"))
);
- return new WebServiceContextImpl(msgCtx);
+ return msgCtx;
}
/**
@@ -438,10 +439,11 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
request.getAny().add(createAppliesToElement("http://dummy-service.com/dummy"));
- WebServiceContextImpl webServiceContext = setupMessageContext();
+ Map<String, Object> msgCtx = setupMessageContext();
List<RequestSecurityTokenResponseType> securityTokenResponse = issueToken(issueOperation, request,
- webServiceContext);
+ new CustomTokenPrincipal("alice"),
+ msgCtx);
// Test the generated token.
Element assertion = null;
@@ -567,10 +569,9 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponseList = issueToken(issueOperation,
- request, webServiceContext);
+ request, null, msgCtx);
RequestSecurityTokenResponseType securityTokenResponse = securityTokenResponseList.get(0);
// Test the generated token.
@@ -721,10 +722,9 @@ public class IssueSamlClaimsUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponseList = issueToken(issueOperation,
- request, webServiceContext);
+ request, null, msgCtx);
RequestSecurityTokenResponseType securityTokenResponse = securityTokenResponseList.get(0);
// Test the generated token.
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
index f8badb0..88c7384 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlRealmUnitTest.java
@@ -32,7 +32,6 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -114,15 +113,15 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "ldap");
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -190,15 +189,15 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -266,15 +265,15 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "unknown");
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -351,16 +350,16 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token - this will fail as the SAMLRealm configuration is inconsistent
// no signature alias defined
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
fail("Failure expected on no encryption name");
} catch (STSException ex) {
// expected
@@ -370,7 +369,7 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert {
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -449,15 +448,15 @@ public class IssueSamlRealmUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java
index d3a0332..4231365 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueSamlUnitTest.java
@@ -33,7 +33,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Text;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -136,15 +135,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -208,15 +207,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -281,15 +280,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -367,15 +366,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(requestCollection, webServiceContext);
+ issueOperation.issue(requestCollection, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertEquals(securityTokenResponse.size(), 2);
@@ -461,15 +460,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -538,15 +537,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
fail("Failure expected on no certificate");
} catch (STSException ex) {
// expected failure on no certificate
@@ -559,7 +558,7 @@ public class IssueSamlUnitTest extends org.junit.Assert {
request.getAny().add(useKeyType);
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -634,11 +633,11 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Now add Entropy
BinarySecretType binarySecretType = new BinarySecretType();
@@ -656,7 +655,7 @@ public class IssueSamlUnitTest extends org.junit.Assert {
request.getAny().add(entropyJaxbType);
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -727,11 +726,11 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Now add Entropy
BinarySecretType binarySecretType = new BinarySecretType();
@@ -749,7 +748,7 @@ public class IssueSamlUnitTest extends org.junit.Assert {
request.getAny().add(entropyJaxbType);
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -819,11 +818,11 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Now add Entropy
WSSecEncryptedKey builder = new WSSecEncryptedKey();
@@ -843,7 +842,7 @@ public class IssueSamlUnitTest extends org.junit.Assert {
request.getAny().add(entropyJaxbType);
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -932,15 +931,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -1012,15 +1011,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -1103,15 +1102,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -1187,15 +1186,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -1232,7 +1231,7 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// This should fail as the UseKey certificate is not trusted
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
fail("Failure expected as the UseKey certificate is not trusted");
} catch (STSException ex) {
// expected
@@ -1240,7 +1239,7 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Now allow non-trusted UseKey certificates...
stsProperties.setValidateUseKey(false);
- response = issueOperation.issue(request, webServiceContext);
+ response = issueOperation.issue(request, principal, msgCtx);
securityTokenResponse = response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
}
@@ -1303,15 +1302,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -1395,15 +1394,15 @@ public class IssueSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, principal, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java
index d22fc3b..f6ee62b 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/IssueUnitTest.java
@@ -29,7 +29,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.sts.QNameConstants;
@@ -87,11 +86,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -138,11 +136,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(requestCollection, webServiceContext);
+ issueOperation.issue(requestCollection, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertEquals(securityTokenResponse.size(), 2);
@@ -181,11 +178,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token - failure expected on an unknown token type
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected on an unknown token type");
} catch (STSException ex) {
// expected
@@ -194,7 +190,7 @@ public class IssueUnitTest extends org.junit.Assert {
// Issue a token - failure expected as no token type is sent
request.getAny().remove(0);
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected on no token type");
} catch (STSException ex) {
// expected
@@ -205,7 +201,7 @@ public class IssueUnitTest extends org.junit.Assert {
issueOperation.setServices(Collections.singletonList(service));
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -246,11 +242,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token - failure expected on an unknown address
try {
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
fail("Failure expected on an unknown address");
} catch (STSException ex) {
// expected
@@ -261,7 +256,7 @@ public class IssueUnitTest extends org.junit.Assert {
issueOperation.setServices(Collections.singletonList(service));
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -299,11 +294,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -345,11 +339,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -394,11 +387,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseCollectionType response =
- issueOperation.issue(request, webServiceContext);
+ issueOperation.issue(request, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertTrue(!securityTokenResponse.isEmpty());
@@ -437,11 +429,10 @@ public class IssueUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Issue a token
RequestSecurityTokenResponseType response =
- issueOperation.issueSingle(request, webServiceContext);
+ issueOperation.issueSingle(request, null, msgCtx);
assertTrue(!response.getAny().isEmpty());
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java
index 3da66d4..96ca530 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/RenewSamlUnitTest.java
@@ -31,7 +31,6 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -145,15 +144,15 @@ public class RenewSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Renew a token
RequestSecurityTokenResponseType response =
- renewOperation.renew(request, webServiceContext);
+ renewOperation.renew(request, principal, msgCtx);
assertTrue(response != null && response.getAny() != null && !response.getAny().isEmpty());
// Test the generated token.
@@ -239,15 +238,15 @@ public class RenewSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
- // Validate a token
+ // Renew a token
RequestSecurityTokenResponseType response =
- renewOperation.renew(request, webServiceContext);
+ renewOperation.renew(request, principal, msgCtx);
assertTrue(response != null && response.getAny() != null && !response.getAny().isEmpty());
@@ -333,15 +332,15 @@ public class RenewSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
- // Validate a token
+ // Renew a token
RequestSecurityTokenResponseType response =
- renewOperation.renew(request, webServiceContext);
+ renewOperation.renew(request, principal, msgCtx);
assertTrue(response != null && response.getAny() != null && !response.getAny().isEmpty());
@@ -422,15 +421,15 @@ public class RenewSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
- // Validate a token
+ // Renew a token
RequestSecurityTokenResponseType response =
- renewOperation.renew(request, webServiceContext);
+ renewOperation.renew(request, principal, msgCtx);
assertTrue(response != null && response.getAny() != null && !response.getAny().isEmpty());
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java
index 54f9b9a..cba7187 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTTransformationTest.java
@@ -34,7 +34,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.rs.security.jose.jws.JwsJwtCompactConsumer;
@@ -143,15 +142,15 @@ public class ValidateJWTTransformationTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
@@ -229,23 +228,23 @@ public class ValidateJWTTransformationTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
msgCtx.put("url", "https");
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token - this will fail as the tokenProvider doesn't understand how to handle
// realm "B"
try {
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
} catch (STSException ex) {
// expected
}
samlTokenProvider.setRealmMap(createSamlRealms());
- RequestSecurityTokenResponseType response = validateOperation.validate(request, webServiceContext);
+ RequestSecurityTokenResponseType response = validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
@@ -319,15 +318,15 @@ public class ValidateJWTTransformationTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTUnitTest.java
index 0c520e3..8bc5efb 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateJWTUnitTest.java
@@ -29,7 +29,6 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -111,15 +110,15 @@ public class ValidateJWTUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSCTUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSCTUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSCTUnitTest.java
index 0d0bd77..4ea8e97 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSCTUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSCTUnitTest.java
@@ -29,7 +29,6 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -120,21 +119,21 @@ public class ValidateSCTUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
// Now remove the token from the cache before validating again
tokenStore.remove(tokenStore.getToken(providerResponse.getTokenId()).getId());
assertNull(tokenStore.getToken(providerResponse.getTokenId()));
- response = validateOperation.validate(request, webServiceContext);
+ response = validateOperation.validate(request, principal, msgCtx);
assertFalse(validateResponse(response));
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java
index faf5d47..a39b437 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateSamlUnitTest.java
@@ -30,7 +30,6 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -117,15 +116,15 @@ public class ValidateSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
}
@@ -178,15 +177,15 @@ public class ValidateSamlUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
index 9853ec2..d8ac35e 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateTokenTransformationUnitTest.java
@@ -33,7 +33,6 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.cxf.helpers.DOMUtils;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.rt.security.claims.Claim;
@@ -145,15 +144,15 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
@@ -231,23 +230,23 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
msgCtx.put("url", "https");
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token - this will fail as the tokenProvider doesn't understand how to handle
// realm "B"
try {
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
} catch (STSException ex) {
// expected
}
samlTokenProvider.setRealmMap(createSamlRealms());
- RequestSecurityTokenResponseType response = validateOperation.validate(request, webServiceContext);
+ RequestSecurityTokenResponseType response = validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
@@ -419,11 +418,10 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
- // run the test
+ // Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, null, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
@@ -513,15 +511,15 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("ted");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("ted"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
@@ -648,11 +646,10 @@ public class ValidateTokenTransformationUnitTest extends org.junit.Assert {
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
msgCtx.put("url", "https");
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
- // run the test
+ // Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, null, msgCtx);
assertTrue(validateResponse(response));
// Test the generated token.
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUnitTest.java
index c4e774e..099371d 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUnitTest.java
@@ -24,7 +24,6 @@ import java.util.List;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.sts.QNameConstants;
@@ -85,11 +84,10 @@ public class ValidateUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, null, msgCtx);
assertTrue(validateResponse(response));
}
@@ -150,11 +148,10 @@ public class ValidateUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseCollectionType response =
- requestCollectionOperation.requestCollection(requestCollection, webServiceContext);
+ requestCollectionOperation.requestCollection(requestCollection, null, msgCtx);
List<RequestSecurityTokenResponseType> securityTokenResponse =
response.getRequestSecurityTokenResponse();
assertEquals(securityTokenResponse.size(), 2);
@@ -189,11 +186,10 @@ public class ValidateUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
try {
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, null, msgCtx);
fail("Failure expected when no element is presented for validation");
} catch (STSException ex) {
// expected
@@ -235,11 +231,10 @@ public class ValidateUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token - failure expected on an unknown token type
try {
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, null, msgCtx);
fail("Failure expected on an unknown token type");
} catch (STSException ex) {
// expected
@@ -248,7 +243,7 @@ public class ValidateUnitTest extends org.junit.Assert {
// Validate a token - no token type is sent, so it defaults to status
request.getAny().remove(0);
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, null, msgCtx);
assertTrue(validateResponse(response));
}
@@ -290,11 +285,10 @@ public class ValidateUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, null, msgCtx);
assertTrue(validateResponse(response));
assertTrue("AuthenticationContext".equals(response.getContext()));
}
http://git-wip-us.apache.org/repos/asf/cxf/blob/53a46205/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java
----------------------------------------------------------------------
diff --git a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java
index 53b04cf..de4cf4b 100644
--- a/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java
+++ b/services/sts/sts-core/src/test/java/org/apache/cxf/sts/operation/ValidateUsernameTokenUnitTest.java
@@ -26,7 +26,6 @@ import java.util.Properties;
import javax.xml.bind.JAXBElement;
import javax.xml.namespace.QName;
-import org.apache.cxf.jaxws.context.WebServiceContextImpl;
import org.apache.cxf.jaxws.context.WrappedMessageContext;
import org.apache.cxf.message.MessageImpl;
import org.apache.cxf.security.SecurityContext;
@@ -104,15 +103,15 @@ public class ValidateUsernameTokenUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertTrue(validateResponse(response));
}
@@ -161,15 +160,15 @@ public class ValidateUsernameTokenUnitTest extends org.junit.Assert {
// Mock up message context
MessageImpl msg = new MessageImpl();
WrappedMessageContext msgCtx = new WrappedMessageContext(msg);
+ Principal principal = new CustomTokenPrincipal("alice");
msgCtx.put(
SecurityContext.class.getName(),
- createSecurityContext(new CustomTokenPrincipal("alice"))
+ createSecurityContext(principal)
);
- WebServiceContextImpl webServiceContext = new WebServiceContextImpl(msgCtx);
// Validate a token
RequestSecurityTokenResponseType response =
- validateOperation.validate(request, webServiceContext);
+ validateOperation.validate(request, principal, msgCtx);
assertFalse(validateResponse(response));
}