public static void secureMessage(ProcessingContext context)
throws XWSSecurityException {
HarnessUtil.validateContext (context);
SecurityPolicy policy = context.getSecurityPolicy ();
SecurityEnvironment handler = context.getSecurityEnvironment ();
StaticPolicyContext staticContext = context.getPolicyContext ();
FilterProcessingContext fpContext = setFilterProcessingContext(context);
fpContext.isInboundMessage (false);
if (fpContext.resetMustUnderstand()) {
fpContext.getSecurableSoapMessage().setDoNotSetMU(true);
}
if (PolicyTypeUtil.messagePolicy(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 (false);
ProcessingContext.copy (dynamicContext.getRuntimeProperties(), context.getExtraneousProperties());
// make dynamic policy callback
DynamicPolicyCallback dpCallback = new DynamicPolicyCallback (policy, dynamicContext);
try {
HarnessUtil.makeDynamicPolicyCallback(dpCallback,
handler.getCallbackHandler());
} catch (Exception e) {
log.log(Level.SEVERE, LogStringsMessages.WSS_0237_FAILED_DYNAMIC_POLICY_CALLBACK(), e);
throw new XWSSecurityException (e);
}
SecurityPolicy result = dpCallback.getSecurityPolicy ();
fpContext.setSecurityPolicy (result);
if (PolicyTypeUtil.messagePolicy(result)) {
processMessagePolicy (fpContext);
} else