fail("Failure expected as Assertion doesn't contain Role information");
} catch (javax.xml.ws.soap.SOAPFaultException ex) {
// expected
}
SamlRoleCallbackHandler roleCallbackHandler =
new SamlRoleCallbackHandler();
roleCallbackHandler.setRoleName("manager");
((BindingProvider)saml2Port).getRequestContext().put(
"ws-security.saml-callback-handler", roleCallbackHandler
);
int result = saml2Port.doubleIt(25);
assertTrue(result == 50);
// Expected failure on incorrect role
roleCallbackHandler.setRoleName("boss");
try {
saml2Port.doubleIt(25);
fail("Failure expected as Assertion doesn't contain correct role");
} catch (javax.xml.ws.soap.SOAPFaultException ex) {
// expected