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

UsernameToken

public class UsernameToken extends com.sun.xml.ws.policy.PolicyAssertion implements Cloneable, com.sun.xml.ws.security.policy.SecurityAssertionValidator, com.sun.xml.ws.security.policy.UserNameToken
author
K.Venugopal@sun.com

Fields Summary
private String
tokenType
private String
id
private String
includeToken
private boolean
populated
private QName
itQname
private AssertionFitness
fitness
private boolean
hasPassword
Constructors Summary
public UsernameToken()
Creates a new instance of UsernameToken

               
      
        UUID uid = UUID.randomUUID();
        id= uid.toString();
    
public UsernameToken(com.sun.xml.ws.policy.sourcemodel.AssertionData name, Collection nestedAssertions, com.sun.xml.ws.policy.AssertionSet nestedAlternative)

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

        throw new UnsupportedOperationException();
    
public java.lang.StringgetIncludeToken()

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

        return id;
    
public java.lang.StringgetType()

        populate();
        return tokenType;
    
public booleanhasPassword()

        return hasPassword;
    
private voidpopulate()

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

        if(!populated){
            if(this.getAttributeValue(itQname) != null){
                this.includeToken = this.getAttributeValue(itQname);
            }
            NestedPolicy policy = this.getNestedPolicy();
            if(policy == null){
                if(logger.getLevel() == Level.FINE){
                    logger.log(Level.FINE,"NestedPolicy is null");
                }
                populated = true;
                return fitness;
            }
            AssertionSet assertionSet = policy.getAssertionSet();
            for(PolicyAssertion assertion: assertionSet){
                if(PolicyUtil.isUsernameTokenType(assertion)){
                    tokenType = assertion.getName().getLocalPart();
                }else if(PolicyUtil.hasPassword(assertion)){
                    hasPassword = false;
                }else{
                    if(!assertion.isOptional()){
                        log_invalid_assertion(assertion, isServer,"UsernameToken");
                        fitness = AssertionFitness.HAS_UNKNOWN_ASSERTION;
                    }
                }
            }
            populated = true;
        }
        return fitness;
    
public voidsetIncludeToken(java.lang.String type)

        Map<QName, String> attrs = this.getAttributes();
        QName itQname = new QName(Constants.SECURITY_POLICY_NS, Constants.IncludeToken);
        attrs.put(itQname,type);
    
public voidsetTokenId(java.lang.String _id)

        this.id = _id;
    
public voidsetType(java.lang.String type)

        this.tokenType = type;
    
public AssertionFitnessvalidate(boolean isServer)

        return populate(isServer);