use of org.jboss.security.auth.message.GenericMessageInfo in project jbossws-cxf by jbossws.
the class JaspiClientAuthenticator method secureRequest.
public void secureRequest(SoapMessage message) {
SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
MessageInfo messageInfo = new GenericMessageInfo(soapMessage, null);
String authContextID = clientConfig.getAuthContextID(messageInfo);
Properties serverContextProperties = new Properties();
serverContextProperties.put("security-domain", securityDomain);
serverContextProperties.put("jaspi-policy", jpi);
Subject clientSubject = new Subject();
@SuppressWarnings("unused") AuthStatus authStatus = null;
try {
ClientAuthContext cctx = clientConfig.getAuthContext(authContextID, clientSubject, serverContextProperties);
authStatus = cctx.secureRequest(messageInfo, clientSubject);
} catch (AuthException e) {
if (isSOAP12(message)) {
SoapFault soap12Fault = new SoapFault(e.getMessage(), Soap12.getInstance().getSender());
throw soap12Fault;
} else {
throw new SoapFault(e.getMessage(), new QName("", "japsi AuthException"));
}
}
// TODO:look at how to handle AuthStatus
}
use of org.jboss.security.auth.message.GenericMessageInfo in project jbossws-cxf by jbossws.
the class JaspiClientAuthenticator method validateResponse.
public void validateResponse(SoapMessage message) {
SOAPMessage request = message.getExchange().getInMessage().get(SOAPMessage.class);
SOAPMessage response = message.getContent(SOAPMessage.class);
MessageInfo messageInfo = new GenericMessageInfo(request, response);
String authContextID = clientConfig.getAuthContextID(messageInfo);
Properties serverContextProperties = new Properties();
serverContextProperties.put("security-domain", securityDomain);
serverContextProperties.put("jaspi-policy", jpi);
Subject clientSubject = new Subject();
@SuppressWarnings("unused") AuthStatus authStatus = null;
try {
ClientAuthContext sctx = clientConfig.getAuthContext(authContextID, clientSubject, serverContextProperties);
authStatus = sctx.validateResponse(messageInfo, new Subject(), new Subject());
} catch (AuthException e) {
if (isSOAP12(message)) {
SoapFault soap12Fault = new SoapFault(e.getMessage(), Soap12.getInstance().getSender());
throw soap12Fault;
} else {
throw new SoapFault(e.getMessage(), new QName("", "japsi AuthException"));
}
}
// TODO:handle AuthStatus
}
Aggregations