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

EncryptionAssertionProcessor

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

Fields Summary
private com.sun.xml.ws.security.policy.AlgorithmSuite
algorithmSuite
private boolean
bodyEncrypted
private boolean
enforce
private HashSet
encryptedParts
private EncryptionTargetCreator
etCreator
Constructors Summary
public EncryptionAssertionProcessor(com.sun.xml.ws.security.policy.AlgorithmSuite algorithmSuite, boolean enforce)
Creates a new instance of EncryptionAssertionProcessor

           
        
        this.algorithmSuite = algorithmSuite;
        this.enforce = enforce;
        this.etCreator = new EncryptionTargetCreator(algorithmSuite,enforce);
    
Methods Summary
public EncryptionTargetCreatorgetTargetCreator()

        return etCreator;
    
public voidprocess(com.sun.xml.ws.security.policy.EncryptedParts encryptParts, EncryptionPolicy.FeatureBinding binding)

        if(SecurityPolicyUtil.isEncryptedPartsEmpty(encryptParts)){
            if(!bodyEncrypted){
                EncryptionTarget target = etCreator.newQNameEncryptionTarget(EncryptionTarget.BODY_QNAME);
                target.setContentOnly(true);
                binding.addTargetBinding(target);              
                bodyEncrypted = true;
            }
        }
        Iterator tv = encryptParts.getTargets();
        while(tv.hasNext()){
            Header ht = (Header)tv.next();
            if(!seenEncryptedParts(ht)){
                EncryptionTarget target = etCreator.newQNameEncryptionTarget(new QName(ht.getURI(),ht.getLocalName()));
                target.isSOAPHeadersOnly(true);
                binding.addTargetBinding(target);               
            }
        }
        
        if(encryptParts.hasBody() && !bodyEncrypted){
            EncryptionTarget target = etCreator.newQNameEncryptionTarget(EncryptionTarget.BODY_QNAME);
            target.setContentOnly(true);
            binding.addTargetBinding(target);         
            bodyEncrypted = true;
        }
    
public voidprocess(com.sun.xml.ws.security.policy.EncryptedElements encryptedElements, EncryptionPolicy.FeatureBinding binding)

        Iterator<String> eeItr = encryptedElements.getTargets();
        while(eeItr.hasNext()){
            String xpathTarget = eeItr.next();
            EncryptionTarget target = etCreator.newXpathEncryptionTarget(xpathTarget);
            binding.addTargetBinding(target);          
        }
    
public voidprocess(javax.xml.namespace.QName targetName, EncryptionPolicy.FeatureBinding binding)

        EncryptionTarget target = etCreator.newQNameEncryptionTarget(targetName);
        binding.addTargetBinding(target);      
    
private booleanseenEncryptedParts(com.sun.xml.ws.security.policy.Header header)

        if(encryptedParts.contains(header)){
            return true;
        }
        encryptedParts.add(header);
        return false;