} catch (javax.xml.ws.soap.SOAPFaultException ex) {
assertTrue(ex.getMessage().contains("No SAML CallbackHandler available"));
}
((BindingProvider)saml2Port).getRequestContext().put(
"ws-security.saml-callback-handler", new SamlCallbackHandler(false)
);
try {
saml2Port.doubleIt(25);
fail("Expected failure on an invocation with a SAML1 Assertion");
} catch (javax.xml.ws.soap.SOAPFaultException ex) {
assertTrue(ex.getMessage().contains("Wrong SAML Version"));
}
((BindingProvider)saml2Port).getRequestContext().put(
"ws-security.saml-callback-handler", new SamlCallbackHandler()
);
int result = saml2Port.doubleIt(25);
assertTrue(result == 50);
try {
SamlCallbackHandler callbackHandler =
new SamlCallbackHandler();
callbackHandler.setConfirmationMethod(SAML2Constants.CONF_BEARER);
((BindingProvider)saml2Port).getRequestContext().put(
"ws-security.saml-callback-handler", callbackHandler
);
saml2Port.doubleIt(25);
fail("Expected failure on an invocation with a invalid SAML2 Assertion");