// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
"ws-security.username", "alice"
);
BindingProvider p = (BindingProvider)port;
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
"http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
);
doubleIt(port, 25);
// Make a successful invocation
((BindingProvider)port).getRequestContext().put(
"ws-security.username", "bob"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
"http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
);
doubleIt(port, 25);
// Change the STSClient so that it can no longer find the STS
clearSTSClient(p);
// Make a successful invocation - should work as token is cached
((BindingProvider)port).getRequestContext().put(
"ws-security.username", "alice"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
"http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew"
);
doubleIt(port, 25);
// Make a successful invocation - should work as token is cached
((BindingProvider)port).getRequestContext().put(
"ws-security.username", "bob"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
"http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
);
doubleIt(port, 25);
// Change appliesTo - should fail
((BindingProvider)port).getRequestContext().put(
"ws-security.username", "alice"
);
p.getRequestContext().put(
SecurityConstants.STS_APPLIES_TO,
"http://localhost:" + PORT + "/doubleit/services/doubleitasymmetricnew2"
);
try {
doubleIt(port, 30);