FileDocCategorySizeDatePackage
SCTokenWrapper.javaAPI DocExample7563Tue May 29 16:56:50 BST 2007com.sun.xml.ws.security.impl.policyconv

SCTokenWrapper

public class SCTokenWrapper extends com.sun.xml.ws.policy.PolicyAssertion implements com.sun.xml.ws.security.policy.SecureConversationToken
author
K.Venugopal@sun.com

Fields Summary
private com.sun.xml.ws.security.policy.SecureConversationToken
scToken
private com.sun.xml.wss.impl.policy.mls.MessagePolicy
messagePolicy
private List
tokenList
private boolean
cached
Constructors Summary
public SCTokenWrapper(com.sun.xml.ws.policy.PolicyAssertion scToken, com.sun.xml.wss.impl.policy.mls.MessagePolicy mp)
Creates a new instance of SCTokenWrapper

           
        
        super(AssertionData.createAssertionData(scToken.getName(),scToken.getValue(),scToken.getAttributes()),getNestedAssertions(scToken),
                (scToken.getNestedPolicy()== null ? null : scToken.getNestedPolicy().getAssertionSet()));
        this.scToken = (SecureConversationToken)scToken;
        this.messagePolicy = mp;
    
Methods Summary
public voidaddBootstrapPolicy(com.sun.xml.ws.policy.NestedPolicy policy)

    
private voidaddToken(com.sun.xml.ws.security.policy.Token token, java.util.ArrayList list)

        if(PolicyUtil.isIssuedToken((PolicyAssertion)token)){
            list.add((PolicyAssertion)token);
        }
    
public com.sun.xml.ws.policy.NestedPolicygetBootstrapPolicy()

        return this.scToken.getBootstrapPolicy();
    
public java.lang.StringgetIncludeToken()

        return this.scToken.getIncludeToken();
    
public java.util.ListgetIssuedTokens()

        if(!cached){
            if(this.hasNestedPolicy()){
                tokenList = getTokens(this.getNestedPolicy());
                cached = true;
            }
        }
        return tokenList;
    
public com.sun.xml.ws.security.policy.IssuergetIssuer()

        return this.scToken.getIssuer();
    
public com.sun.xml.wss.impl.policy.mls.MessagePolicygetMessagePolicy()

        return messagePolicy;
    
private static java.util.CollectiongetNestedAssertions(com.sun.xml.ws.policy.PolicyAssertion scToken)

        if(scToken.hasNestedAssertions()){
            Iterator<PolicyAssertion> itr = scToken.getNestedAssertionsIterator();
            if(itr.hasNext()){// will have only one assertion set. TODO:Cross check with marek.
                return Collections.singletonList(itr.next());
            }
        }
        return null;
        
    
public com.sun.xml.ws.security.policy.SecureConversationTokengetSecureConversationToken()

        return scToken;
    
public java.lang.StringgetTokenId()

        return this.scToken.getTokenId();
    
public java.util.SetgetTokenRefernceTypes()

        return this.scToken.getTokenRefernceTypes();
    
public java.lang.StringgetTokenType()

        return this.scToken.getTokenType();
    
private java.util.ArrayListgetTokens(com.sun.xml.ws.policy.NestedPolicy policy)

        ArrayList<PolicyAssertion> tokenList = new ArrayList<PolicyAssertion>();
        AssertionSet assertionSet = policy.getAssertionSet();
        for(PolicyAssertion pa:assertionSet){
            if(PolicyUtil.isBootstrapPolicy(pa)){
                NestedPolicy np = pa.getNestedPolicy();
                AssertionSet bpSet = np.getAssertionSet();
                for(PolicyAssertion assertion:bpSet){
                    if(PolicyUtil.isAsymmetricBinding(assertion)){
                        AsymmetricBinding sb =  (AsymmetricBinding)assertion;
                        addToken(sb.getInitiatorToken(),tokenList);
                        addToken(sb.getRecipientToken(),tokenList);
                    }else if(PolicyUtil.isSymmetricBinding(assertion)){
                        SymmetricBinding sb = (SymmetricBinding)assertion;
                        Token token = sb.getProtectionToken();
                        if(token != null){
                            addToken(token,tokenList);
                        }else{
                            addToken(sb.getEncryptionToken(),tokenList);
                            addToken(sb.getSignatureToken(),tokenList);
                        }
                    }else if(PolicyUtil.isSupportingTokens(assertion)){
                        SupportingTokens st = (SupportingTokens)assertion;
                        Iterator itr = st.getTokens();
                        while(itr.hasNext()){
                            addToken((Token)itr.next(),tokenList);
                        }
                    }
                }
            }
            
        }
        return tokenList;
    
public booleanisRequireDerivedKeys()

        return this.scToken.isRequireDerivedKeys();
    
public voidsetMessagePolicyp(com.sun.xml.wss.impl.policy.mls.MessagePolicy mp)

        this.messagePolicy = mp;
    
public voidsetSecureConversationToken(com.sun.xml.ws.security.policy.SecureConversationToken scToken)

        this.scToken = scToken;