FileDocCategorySizeDatePackage
IntegrityAssertionProcessor.javaAPI DocExample6350Tue May 29 16:56:48 BST 2007com.sun.xml.ws.security.impl.policyconv

IntegrityAssertionProcessor

public class IntegrityAssertionProcessor extends Object
author
K.Venugopal@sun.com

Fields Summary
private com.sun.xml.ws.security.policy.AlgorithmSuite
algorithmSuite
private boolean
contentOnly
private boolean
seenBody
private HashSet
signParts
private boolean
allHeaders
private boolean
ENFORCE
private SignatureTargetCreator
targetCreator
Constructors Summary
public IntegrityAssertionProcessor(com.sun.xml.ws.security.policy.AlgorithmSuite algorithmSuite, boolean contentOnly)
Creates a new instance of IntegrityAssertionProcessor

    
           
    
         
        this.algorithmSuite = algorithmSuite;
        this.contentOnly = contentOnly;
        targetCreator = new SignatureTargetCreator(false,algorithmSuite,contentOnly);
    
Methods Summary
public SignatureTargetCreatorgetTargetCreator()

        return targetCreator;
    
public voidprocess(com.sun.xml.ws.security.policy.SignedParts signedParts, SignaturePolicy.FeatureBinding binding)

        Iterator tv = signedParts.getHeaders();
        if(SecurityPolicyUtil.isSignedPartsEmpty(signedParts)){
            if(!allHeaders){
                SignatureTarget target = targetCreator.newURISignatureTarget("");
                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);
                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()));
                    target.isSOAPHeadersOnly(true);
                    target.setContentOnly(contentOnly);
                    binding.addTargetBinding(target);
                }
            }
            if(signedParts.hasBody()){
                if(!seenBody){
                    SignatureTarget target = targetCreator.newQNameSignatureTarget(Target.BODY_QNAME);
                    target.setContentOnly(contentOnly);
                    binding.addTargetBinding(target);
                    seenBody = true;
                }
            }
        }
    
public voidprocess(com.sun.xml.ws.security.policy.SignedElements signedElements, SignaturePolicy.FeatureBinding binding)

        Iterator<String> itr = signedElements.getTargets();
        while(itr.hasNext()){
            String xpathTarget = itr.next();
            SignatureTarget target = targetCreator.newXpathSignatureTarget(xpathTarget);
            target.setContentOnly(contentOnly);
            //  target.setXPathVersion(signedElements.)
            binding.addTargetBinding(target);
        }
    
public voidprocess(javax.xml.namespace.QName targetName, SignaturePolicy.FeatureBinding binding)

        SignatureTarget target = targetCreator.newQNameSignatureTarget(targetName);
        binding.addTargetBinding(target);
    
private booleanseenSignTarget(com.sun.xml.ws.security.policy.Header name)

//        Iterator<Header> itr = signParts.iterator();
//        while(itr.hasNext()){
//            Header header = itr.next();
//            if(header.getLocalName().equals(name.getLocalName()) && header.getURI().equals(name.getURI())){
//                return true;
//            }
//        }
        if(signParts.contains(name)){
            return true;
        }
        signParts.add(name);
        return false;