FileDocCategorySizeDatePackage
TransportBindingProcessor.javaAPI DocExample7683Thu Jul 19 02:00:10 BST 2007com.sun.xml.ws.security.impl.policyconv

TransportBindingProcessor

public class TransportBindingProcessor extends BindingProcessor
author
K.Venugopal@sun.com

Fields Summary
private com.sun.xml.ws.security.policy.TransportBinding
binding
private com.sun.xml.wss.impl.policy.mls.TimestampPolicy
tp
Constructors Summary
public TransportBindingProcessor(com.sun.xml.ws.security.policy.TransportBinding binding, boolean isServer, boolean isIncoming, XWSSPolicyContainer container)
Creates a new instance of TransportBindingProcessor

           
         
        this.binding = binding;
        this.container = container;
        this.isIncoming = isIncoming;
        this.isServer = isServer;
        iAP = new IntegrityAssertionProcessor(binding.getAlgorithmSuite(),false);
        eAP = new EncryptionAssertionProcessor(binding.getAlgorithmSuite(),false);
        this.tokenProcessor  = new TokenProcessor(isServer,isIncoming,pid);
    
Methods Summary
protected voidclose()

      
    
protected com.sun.xml.ws.security.policy.BindinggetBinding()

        return binding;
    
protected com.sun.xml.wss.impl.policy.mls.EncryptionPolicygetSecondaryEncryptionPolicy()

        throw new UnsupportedOperationException();
    
public voidprocess()

        container.setPolicyContainerMode(binding.getLayout());
        if(binding.isIncludeTimeStamp()){
            tp = new TimestampPolicy();
            tp.setUUID(pid.generateID());
            container.insert(tp);
        }
    
public voidprocessSupportingTokens(com.sun.xml.ws.security.policy.SupportingTokens tokens)

        Iterator itr = tokens.getTokens();
        while(itr.hasNext()){
            Token token = (Token) itr.next();
            WSSPolicy policy = tokenProcessor.getWSSToken(token);
            AuthenticationTokenPolicy atp = new AuthenticationTokenPolicy();
            atp.setFeatureBinding(policy);
            container.insert(atp);
        }
    
public voidprocessSupportingTokens(com.sun.xml.ws.security.policy.SignedSupportingTokens sst)

        Iterator itr = sst.getTokens();
        while(itr.hasNext()){
            Token token = (Token) itr.next();
            WSSPolicy policy = tokenProcessor.getWSSToken(token);
            AuthenticationTokenPolicy atp = new AuthenticationTokenPolicy();
            atp.setFeatureBinding(policy);
            container.insert(atp);
        }
    
public voidprocessSupportingTokens(com.sun.xml.ws.security.policy.EndorsingSupportingTokens est)

        Iterator itr = est.getTokens();
        while(itr.hasNext()){
            Token token = (Token) itr.next();
            SignaturePolicy sp = new SignaturePolicy();
            SignaturePolicy.FeatureBinding spFB = (com.sun.xml.wss.impl.policy.mls.SignaturePolicy.FeatureBinding)sp.getFeatureBinding();
            //spFB.setCanonicalizationAlgorithm(CanonicalizationMethod.EXCLUSIVE);
            SecurityPolicyUtil.setCanonicalizationMethod(spFB, binding.getAlgorithmSuite());
            sp.setUUID(pid.generateID());
            tokenProcessor.addKeyBinding(sp, token,false);
           // container.insert(sp.getKeyBinding());

            if(tp != null ){
                SignatureTarget target = iAP.getTargetCreator().newURISignatureTarget(tp.getUUID());
                SecurityPolicyUtil.setName(target, tp);
                // there is no primary signature in Transport Binding
                //spFB.isEndorsingSignature(true);
                spFB.addTargetBinding(target);
                
                container.insert(sp);
            }
           
        }
    
public voidprocessSupportingTokens(com.sun.xml.ws.security.policy.SignedEndorsingSupportingTokens set)

        Iterator itr = set.getTokens();
        while(itr.hasNext()){
            Token token = (Token) itr.next();
            SignaturePolicy sp = new SignaturePolicy();
            sp.setUUID(pid.generateID());
            SignaturePolicy.FeatureBinding spFB = (com.sun.xml.wss.impl.policy.mls.SignaturePolicy.FeatureBinding)sp.getFeatureBinding();
            //spFB.setCanonicalizationAlgorithm(CanonicalizationMethod.EXCLUSIVE);
            SecurityPolicyUtil.setCanonicalizationMethod(spFB, binding.getAlgorithmSuite());
            tokenProcessor.addKeyBinding(sp, token,false);
           
            //protect primary signature
            
            if(tp != null){
                SignatureTarget target = iAP.getTargetCreator().newURISignatureTarget(tp.getUUID());
                SecurityPolicyUtil.setName(target, tp);
                //SignaturePolicy.FeatureBinding spFB = (SignaturePolicy.FeatureBinding)sp.getFeatureBinding();
                //spFB.isEndorsingSignature(true);
                spFB.addTargetBinding(target);
                container.insert(sp);
            }           
        }