public void verifyPolicy(SecurityPolicy recvdPolicy, SecurityPolicy configPolicy) throws PolicyViolationException {
PolicyAlternatives confPolicies = (PolicyAlternatives)configPolicy;
List<MessagePolicy> mps = confPolicies.getSecurityPolicy();
if (mps.size() == 1) {
PolicyVerifier verifier = PolicyVerifierFactory.createVerifier(mps.get(0), ctx);
verifier.verifyPolicy(recvdPolicy, mps.get(0));
if (mps.get(0).getPolicyAlternativeId() != null) {
ctx.getExtraneousProperties().put(POLICY_ALTERNATIVE_ID,mps.get(0).getPolicyAlternativeId());
}
return;
} else {
//do policy verification
// try with an AlternativeSelector first
//AlternativeSelector selector = new DefaultAlternativeSelector();
AlternativeSelector selector = findAlternativesSelector(mps);
MessagePolicy toVerify = selector.selectAlternative(ctx, mps, recvdPolicy);
//TODO: the PolicyVerifier.verifyPolicy() method expects the toVerify argument to be
//passed again. since that interface is a legacy interface, not changing it
//right now.
if (toVerify != null) {
PolicyVerifier verifier = PolicyVerifierFactory.createVerifier(toVerify, ctx);
verifier.verifyPolicy(recvdPolicy, toVerify);
if (toVerify.getPolicyAlternativeId() != null) {
ctx.getExtraneousProperties().put(POLICY_ALTERNATIVE_ID,toVerify.getPolicyAlternativeId());
}
return;
} else {