public void process(SignedParts signedParts,SignaturePolicy.FeatureBinding binding){
Iterator tv = signedParts.getHeaders();
if(SecurityPolicyUtil.isSignedPartsEmpty(signedParts)){
if(!allHeaders){
SignatureTarget target = targetCreator.newURISignatureTarget("");
targetCreator.addTransform(target);
target.setValue(SignatureTarget.ALL_MESSAGE_HEADERS);
target.isSOAPHeadersOnly(true);
binding.addTargetBinding(target);
target.setContentOnly(contentOnly);
allHeaders = true;
}
if(!seenBody){
SignatureTarget target = targetCreator.newQNameSignatureTarget(Target.BODY_QNAME);
targetCreator.addTransform(target);
binding.addTargetBinding(target);
target.setContentOnly(contentOnly);
seenBody = true;
}
}else{
while(tv.hasNext()){
Header ht = (Header)tv.next();
if(!allHeaders && !seenSignTarget(ht)){
SignatureTarget target = targetCreator.newQNameSignatureTarget(new QName(ht.getURI(),ht.getLocalName()));
targetCreator.addTransform(target);
target.isSOAPHeadersOnly(true);
target.setContentOnly(contentOnly);
binding.addTargetBinding(target);
}
}
if(signedParts.hasBody()){
if(!seenBody){
SignatureTarget target = targetCreator.newQNameSignatureTarget(Target.BODY_QNAME);
targetCreator.addTransform(target);
target.setContentOnly(contentOnly);
binding.addTargetBinding(target);
seenBody = true;
}
}
if(signedParts.hasAttachments()){
if(!seenAttachments){
SignatureTarget target = targetCreator.newURISignatureTarget("");
target.setValue(MessageConstants.PROCESS_ALL_ATTACHMENTS);
targetCreator.addAttachmentTransform(target, signedParts.attachmentProtectionType());
binding.addTargetBinding(target);
seenAttachments = true;
}
}