public static void validateMessage(ProcessingContext context)
throws XWSSecurityException {
HarnessUtil.validateContext(context);
SecurityPolicy policy = context.getSecurityPolicy();
StaticPolicyContext staticContext = context.getPolicyContext();
FilterProcessingContext fpContext = new FilterProcessingContext(context);
fpContext.isInboundMessage(true);
//MessagePolicy msgPolicy = (MessagePolicy) fpContext.getSecurityPolicy();
if(true /*msgPolicy.enableWSS11Policy()*/){
// set a property in context to determine if its WSS11
fpContext.setExtraneousProperty("EnableWSS11PolicyReceiver","true");
}
//TODO: enable this after policy is available for incoming msgs
if (true /*msgPolicy.enableSignatureConfirmation()*/) {
//For SignatureConfirmation
//Set a list in extraneous property which will store all the received SignatureValues
//If there was no Signature in incoming message this list will be empty
List scList = new ArrayList();
fpContext.setExtraneousProperty("receivedSignValues", scList);
}
if (policy != null) {
if ( PolicyTypeUtil.messagePolicy(policy) &&
!PolicyTypeUtil.applicationSecurityConfiguration(policy) &&
((MessagePolicy)policy).enableDynamicPolicy() &&
((MessagePolicy)policy).size() == 0) {
policy = new com.sun.xml.wss.impl.policy.mls.DynamicSecurityPolicy();
}
if (PolicyTypeUtil.dynamicSecurityPolicy(policy)) {
// create dynamic callback context
DynamicApplicationContext dynamicContext = new DynamicApplicationContext(staticContext);
dynamicContext.setMessageIdentifier(context.getMessageIdentifier());
dynamicContext.inBoundMessage(true);
ProcessingContext.copy(dynamicContext.getRuntimeProperties(), context.getExtraneousProperties());
// make dynamic policy callback
DynamicPolicyCallback dpCallback = new DynamicPolicyCallback(policy, dynamicContext);
HarnessUtil.makeDynamicPolicyCallback(dpCallback,
context.getSecurityEnvironment().getCallbackHandler());
SecurityPolicy result = dpCallback.getSecurityPolicy();
fpContext.setSecurityPolicy(result);
fpContext.setMode(FilterProcessingContext.ADHOC);
if (PolicyTypeUtil.messagePolicy(result)) {
processMessagePolicy(fpContext);