FileDocCategorySizeDatePackage
SecurityContextToken.javaAPI DocExample6533Tue May 29 16:56:48 BST 2007com.sun.xml.ws.security.impl.policy

SecurityContextToken

public class SecurityContextToken extends com.sun.xml.ws.policy.PolicyAssertion implements com.sun.xml.ws.security.policy.SecurityAssertionValidator, com.sun.xml.ws.security.policy.SecurityContextToken
author
Mayank.Mishra@Sun.com

Fields Summary
private String
id
private List
tokenRefType
private boolean
populated
private String
tokenType
private String
includeTokenType
private com.sun.xml.ws.policy.PolicyAssertion
rdKey
private Set
referenceType
private static QName
itQname
private AssertionFitness
fitness
Constructors Summary
public SecurityContextToken(com.sun.xml.ws.policy.sourcemodel.AssertionData name, Collection nestedAssertions, com.sun.xml.ws.policy.AssertionSet nestedAlternative)
Creates a new instance of SecurityContextToken

           
          
        super(name,nestedAssertions,nestedAlternative);
        UUID id = UUID.randomUUID();
        this.id = id.toString();
    
Methods Summary
public java.lang.StringgetIncludeToken()

        populate();
        return includeTokenType;
    
public java.lang.StringgetTokenId()

        return id;
    
public java.util.IteratorgetTokenRefernceType()

        if ( tokenRefType != null ) {
            return tokenRefType.iterator();
        } else {
            return Collections.emptyList().iterator();
        }
    
public java.lang.StringgetTokenType()

        populate();
        return tokenType;
    
public booleanisRequireDerivedKeys()

        populate();
        if (rdKey != null ) {
            return true;
        }
        return false;
    
private voidpopulate()

        populate(false);
    
private synchronized AssertionFitnesspopulate(boolean isServer)

        if(!populated){
            NestedPolicy policy = this.getNestedPolicy();
            if(this.getAttributeValue(itQname) != null){
                includeTokenType = this.getAttributeValue(itQname);
            }
            if(policy == null){
                if(logger.getLevel() == Level.FINE){
                    logger.log(Level.FINE,"NestedPolicy is null");
                }
                populated = true;
                return fitness;
            }
            AssertionSet as = policy.getAssertionSet();
            Iterator<PolicyAssertion> paItr = as.iterator();
            
            while(paItr.hasNext()){
                PolicyAssertion assertion  = paItr.next();
                if(PolicyUtil.isSecurityContextTokenType(assertion)){
                    tokenType = assertion.getName().getLocalPart().intern();
                }else if(PolicyUtil.isRequireDerivedKeys(assertion)){
                    rdKey = assertion;
                }else if(PolicyUtil.isRequireExternalUriReference(assertion)){
                    if(referenceType == null){
                        referenceType =new HashSet<String>();
                    }
                    referenceType.add(assertion.getName().getLocalPart().intern());
                } else{
                    if(!assertion.isOptional()){
                        if(logger.getLevel() == Level.SEVERE){
                            logger.log(Level.SEVERE,"SP0100.invalid.security.assertion",new Object[]{assertion,"SecurityContextToken"});
                        }
                        if(isServer){
                            throw new UnsupportedPolicyAssertion("Policy assertion "+
                                    assertion+" is not supported under SecurityContextToken assertion");
                        }
                    }
                }
            }
            populated = true;
        }
        return fitness;
    
public AssertionFitnessvalidate(boolean isServer)

        return populate(isServer);