FileDocCategorySizeDatePackage
RequestSecurityTokenResponseImpl.javaAPI DocExample27430Tue May 29 16:57:00 BST 2007com.sun.xml.ws.security.trust.impl.elements

RequestSecurityTokenResponseImpl

public class RequestSecurityTokenResponseImpl extends com.sun.xml.ws.security.trust.impl.bindings.RequestSecurityTokenResponseType implements RequestSecurityTokenResponse
Implementation of a RequestSecurityTokenResponse.
author
Manveen Kaur

Fields Summary
private static final Logger
log
private URI
tokenType
private long
keySize
private URI
keyType
private URI
computedKeyAlgorithm
private URI
signatureAlgorithm
private URI
encryptionAlgorithm
private URI
canonAlgorithm
private Lifetime
lifetime
private Entropy
entropy
private com.sun.xml.ws.policy.impl.bindings.AppliesTo
appliesTo
private Authenticator
authenticator
private UseKey
useKey
private ProofEncryption
proofEncryption
private Encryption
encryption
private DelegateTo
delegateTo
private OnBehalfOf
obo
private RequestedSecurityToken
requestedSecToken
private RequestedProofToken
requestedProofToken
private RequestedAttachedReference
requestedAttachedReference
private RequestedUnattachedReference
requestedUnattachedReference
private URI
signWith
private URI
encryptWith
private URI
authenticationType
private SignChallenge
signChallenge
private SignChallengeResponse
signChallengeRes
private boolean
forwardable
private boolean
delegatable
private Issuer
issuer
private Renewing
renewable
private BinaryExchange
binaryExchange
private AllowPostdating
apd
private Status
status
private com.sun.xml.ws.policy.Policy
policy
private com.sun.xml.ws.policy.impl.bindings.PolicyReference
policyRef
private RequestedTokenCancelled
rtc
Constructors Summary
public RequestSecurityTokenResponseImpl()

    
      
        // default empty constructor
    
public RequestSecurityTokenResponseImpl(URI tokenType, URI context, RequestedSecurityToken token, com.sun.xml.ws.policy.impl.bindings.AppliesTo scopes, RequestedAttachedReference attached, RequestedUnattachedReference unattached, RequestedProofToken proofToken, Entropy entropy, Lifetime lifetime, Status status)

        
        setTokenType(tokenType);
        if (context != null) { setContext(context.toString()); }
        if (token != null) { setRequestedSecurityToken(token); }
        if (attached!= null) { setRequestedAttachedReference(attached); }
        if (unattached!= null) { setRequestedUnattachedReference(unattached); }
        if (scopes != null) { setAppliesTo(scopes); }
        if (proofToken != null) { setRequestedProofToken(proofToken); }
        if (entropy != null) { setEntropy(entropy); }
        if (lifetime != null) { setLifetime(lifetime); }
        if (status != null) { setStatus(status); }
    
public RequestSecurityTokenResponseImpl(com.sun.xml.ws.security.trust.impl.bindings.RequestSecurityTokenResponseType rstrType)

        
        this.context = rstrType.getContext();
        final List<Object> list = rstrType.getAny();
        for (int i = 0; i < list.size(); i++) {
            
            if(list.get(i) instanceof AppliesTo){
                setAppliesTo((AppliesTo)list.get(i));
                continue;
            }
            
            final JAXBElement obj = (JAXBElement)list.get(i);
            
            final String local = obj.getName().getLocalPart();
            if (local.equalsIgnoreCase("KeySize")) {
                setKeySize((Long)obj.getValue());
            } else if (local.equalsIgnoreCase("KeyType")){
                setKeyType(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("ComputedKeyAlgorithm")){
                setComputedKeyAlgorithm(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("TokenType")){
                setTokenType(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("AuthenticationType")){
                setAuthenticationType(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("Lifetime")){
                final LifetimeType ltType = (LifetimeType)obj.getValue();
                setLifetime(new LifetimeImpl(ltType));
            } else if (local.equalsIgnoreCase("Entropy")){
                final EntropyType eType = (EntropyType)obj.getValue();
                setEntropy(new EntropyImpl(eType));
            } else if (local.equalsIgnoreCase("Forwardable")){
                setForwardable((Boolean)obj.getValue());
            } else if (local.equalsIgnoreCase("Delegatable")){
                setDelegatable((Boolean)obj.getValue());
            } else if (local.equalsIgnoreCase("SignWith")){
                setSignWith(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("EncryptWith")){
                setEncryptWith(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("SignatureAlgorithm")){
                setSignatureAlgorithm(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("EncryptionAlgorithm")){
                setEncryptionAlgorithm(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("CanonicalizationAlgorithm")){
                setCanonicalizationAlgorithm(new URI((String)obj.getValue()));
            } else if (local.equalsIgnoreCase("AllowPostdating")){
                setAllowPostdating(new AllowPostdatingImpl());
            } else if (local.equalsIgnoreCase("SignChallenge")){
                setSignChallenge(new SignChallengeImpl());
            } else if (local.equalsIgnoreCase("SignChallengeResponse")){
                 setSignChallengeResponse(new SignChallengeResponseImpl());
            } else if (local.equalsIgnoreCase("BinaryExchange")){
                final BinaryExchangeType bcType = (BinaryExchangeType)obj.getValue();
                setBinaryExchange(new BinaryExchangeImpl(bcType));
            } else if (local.equalsIgnoreCase("Issuer")){
                /* EndpointReferenceImpl isType = (EndpointReferenceImpl)obj.getValue();
                setIssuer(new IssuerImpl(isType));*/
            } else if (local.equalsIgnoreCase("Authenticator")){
                final AuthenticatorType aType = (AuthenticatorType)obj.getValue();
                setAuthenticator(new AuthenticatorImpl(aType));
            } else if (local.equalsIgnoreCase("Renewing")){
                setRenewable(new RenewingImpl());
            } else if (local.equalsIgnoreCase("ProofEncryption")){
                final ProofEncryptionType peType = (ProofEncryptionType)obj.getValue();
                setProofEncryption(new ProofEncryptionImpl(peType));
            } else if (local.equalsIgnoreCase("Policy")){
                setPolicy((Policy)obj.getValue());
            } else if (local.equalsIgnoreCase("PolicyReference")){
                setPolicyReference((PolicyReference)obj.getValue());
            } else if (local.equalsIgnoreCase("AppliesTo")){
                setAppliesTo((AppliesTo)obj.getValue());
            } else if (local.equalsIgnoreCase("OnBehalfOf")){
                this.obo = (OnBehalfOf)obj.getValue();
            } else if (local.equalsIgnoreCase("Encryption")){
                final EncryptionType encType = (EncryptionType)obj.getValue();
                setEncryption(new EncryptionImpl(encType));
            } else if (local.equalsIgnoreCase("UseKey")){
                final UseKeyType ukType = (UseKeyType)obj.getValue();
                setUseKey(new UseKeyImpl(ukType));
            } else if (local.equalsIgnoreCase("Status")){
                setStatus((Status)obj.getValue());
            } else if (local.equalsIgnoreCase("DelegateTo")){
                final DelegateToType dtType  = (DelegateToType)obj.getValue();
                setDelegateTo(new DelegateToImpl(dtType));
            } else if (local.equalsIgnoreCase("RequestedProofToken")){
                final RequestedProofTokenType rptType = (RequestedProofTokenType)obj.getValue();
                setRequestedProofToken(new RequestedProofTokenImpl(rptType));
            } else if (local.equalsIgnoreCase("RequestedSecurityToken")){
                final RequestedSecurityTokenType rdstType = (RequestedSecurityTokenType)obj.getValue();
                setRequestedSecurityToken(new RequestedSecurityTokenImpl(rdstType));
            } else if (local.equalsIgnoreCase("RequestedAttachedReference")){
                final RequestedReferenceType rarType = (RequestedReferenceType)obj.getValue();
                setRequestedAttachedReference(new RequestedAttachedReferenceImpl(rarType));
            } else if (local.equalsIgnoreCase("RequestedUnattachedReference")){
                final RequestedReferenceType rarType = (RequestedReferenceType)obj.getValue();
                setRequestedUnattachedReference(new RequestedUnattachedReferenceImpl(rarType));
            } else if (local.equalsIgnoreCase("RequestedTokenCancelled")){
                setRequestedTokenCancelled(new RequestedTokenCancelledImpl());
            } 
        }
    
Methods Summary
public AllowPostdatinggetAllowPostdating()

        return apd;
    
public com.sun.xml.ws.policy.impl.bindings.AppliesTogetAppliesTo()

        return appliesTo;
    
public java.net.URIgetAuthenticationType()

        return authenticationType;
    
public AuthenticatorgetAuthenticator()

        return authenticator;
    
public BinaryExchangegetBinaryExchange()

        return binaryExchange;
    
public java.net.URIgetCanonicalizationAlgorithm()

        return canonAlgorithm;
    
public java.net.URIgetComputedKeyAlgorithm()

        return computedKeyAlgorithm;
    
public booleangetDelegatable()

        return delegatable;
    
public DelegateTogetDelegateTo()

        return delegateTo;
    
public java.net.URIgetEncryptWith()

        return encryptWith;
    
public EncryptiongetEncryption()

        return encryption;
    
public java.net.URIgetEncryptionAlgorithm()

        return encryptionAlgorithm;
    
public EntropygetEntropy()

        return entropy;
    
public booleangetForwardable()

        return forwardable;
    
public IssuergetIssuer()

        return issuer;
    
public longgetKeySize()

        return keySize;
    
public java.net.URIgetKeyType()

        return keyType;
    
public LifetimegetLifetime()

        return lifetime;
    
public OnBehalfOfgetOnBehalfOf()

        return obo;
    
public com.sun.xml.ws.policy.PolicygetPolicy()

        return policy;
    
public com.sun.xml.ws.policy.impl.bindings.PolicyReferencegetPolicyReference()

        return policyRef;
    
public ProofEncryptiongetProofEncryption()

        return proofEncryption;
    
public RenewinggetRenewable()

        return renewable;
    
public RequestedAttachedReferencegetRequestedAttachedReference()

        return requestedAttachedReference;
    
public RequestedProofTokengetRequestedProofToken()

        return requestedProofToken;
    
public RequestedSecurityTokengetRequestedSecurityToken()

        return requestedSecToken;
    
public RequestedTokenCancelledgetRequestedTokenCancelled()

        return this.rtc;
    
public RequestedUnattachedReferencegetRequestedUnattachedReference()

        return requestedUnattachedReference;
    
public SignChallengegetSignChallenge()

        return signChallenge;
    
public SignChallengeResponsegetSignChallengeResponse()

        return signChallengeRes;
    
public java.net.URIgetSignWith()

        return signWith;
    
public java.net.URIgetSignatureAlgorithm()

        return signatureAlgorithm;
    
public StatusgetStatus()

        return status;
    
public java.net.URIgetTokenType()

        return tokenType;
    
public UseKeygetUseKey()

        return useKey;
    
public final voidsetAllowPostdating(AllowPostdating allowPostdating)

        apd = allowPostdating;
        final JAXBElement<AllowPostdatingType> allowPd =
                (new ObjectFactory()).createAllowPostdating((AllowPostdatingType)apd);
        getAny().add(allowPd);
    
public final voidsetAppliesTo(com.sun.xml.ws.policy.impl.bindings.AppliesTo appliesTo)

        getAny().add(appliesTo);
        this.appliesTo = appliesTo;
    
public final voidsetAuthenticationType(java.net.URI uri)

        this.authenticationType = uri;
        final JAXBElement<String> atElement =
                (new ObjectFactory()).createAuthenticationType(uri.toString());
        getAny().add(atElement);
    
public final voidsetAuthenticator(Authenticator authenticator)

        this.authenticator = authenticator;
        final JAXBElement<AuthenticatorType> authType =
                (new ObjectFactory()).createAuthenticator((AuthenticatorType)authenticator);
        getAny().add(authType);
    
public final voidsetBinaryExchange(BinaryExchange exchange)

        binaryExchange = exchange;
        final JAXBElement<BinaryExchangeType> exchangeType =
                (new ObjectFactory()).createBinaryExchange((BinaryExchangeType)exchange);
        getAny().add(exchangeType);
    
public final voidsetCanonicalizationAlgorithm(java.net.URI algorithm)

        canonAlgorithm = algorithm;
        final JAXBElement<String> canonElement =
                (new ObjectFactory()).createCanonicalizationAlgorithm(algorithm.toString());
        getAny().add(canonElement);
    
public final voidsetComputedKeyAlgorithm(java.net.URI algorithm)

        if (algorithm != null) {
            final String ckaString = algorithm.toString();
            if (!ckaString.equalsIgnoreCase(WSTrustConstants.CK_HASH)
            && !ckaString.equalsIgnoreCase(WSTrustConstants.CK_PSHA1)) {
                throw new RuntimeException("Invalid Computed Key Algorithm specified");
            }
            computedKeyAlgorithm = algorithm;
            final JAXBElement<String> ckaElement =
                    (new ObjectFactory()).createComputedKeyAlgorithm(ckaString);
            getAny().add(ckaElement);
        }
    
public final voidsetDelegatable(boolean flag)

        this.delegatable = flag;
        final JAXBElement<Boolean> del =
                (new ObjectFactory()).createDelegatable(flag);
        getAny().add(del);
    
public final voidsetDelegateTo(DelegateTo to)

        this.delegateTo = to;
        final JAXBElement<DelegateToType> dtElement =
                (new ObjectFactory()).createDelegateTo((DelegateToType)to);
        getAny().add(dtElement);
    
public final voidsetEncryptWith(java.net.URI algorithm)

        encryptWith = algorithm;
        final JAXBElement<String> sElement =  (new ObjectFactory()).createEncryptWith(algorithm.toString());
        getAny().add(sElement);
    
public final voidsetEncryption(Encryption enc)

        this.encryption = enc;
        final JAXBElement<EncryptionType> encElement =
                (new ObjectFactory()).createEncryption((EncryptionType)enc);
        getAny().add(encElement);
    
public final voidsetEncryptionAlgorithm(java.net.URI algorithm)

        encryptionAlgorithm = algorithm;
        final JAXBElement<String> encElement =
                (new ObjectFactory()).createEncryptionAlgorithm(algorithm.toString());
        getAny().add(encElement);
    
public final voidsetEntropy(Entropy entropy)

        this.entropy = entropy;
        final JAXBElement<EntropyType> etElement =
                (new ObjectFactory()).createEntropy((EntropyType)entropy);
        getAny().add(etElement);
    
public final voidsetForwardable(boolean flag)

        forwardable = flag;
        final JAXBElement<Boolean> forward =
                (new ObjectFactory()).createForwardable(flag);
        getAny().add(forward);
    
public final voidsetIssuer(Issuer issuer)

        this.issuer = issuer;
       /* JAXBElement<EndpointReferenceImpl> eprType =
                (new com.sun.xml.ws.security.trust.impl.bindings.ObjectFactory()).createIssuer((EndpointReferenceImpl)issuer);
        getAny().add(eprType);*/
    
public final voidsetKeySize(long size)

        keySize = size;
        final JAXBElement<Long> ksElement =  (new ObjectFactory()).createKeySize(size);
        getAny().add(ksElement);
    
public final voidsetKeyType(java.net.URI keytype)

                
        if (! (keytype.toString().equalsIgnoreCase(RequestSecurityToken.PUBLIC_KEY_TYPE)
        || keytype.toString().equalsIgnoreCase(RequestSecurityToken.SYMMETRIC_KEY_TYPE) )){
            log.log(Level.SEVERE,
                    LogStringsMessages.WST_0025_INVALID_KEY_TYPE(keytype.toString(), null));
            throw new WSTrustException(LogStringsMessages.WST_0025_INVALID_KEY_TYPE(keytype.toString(), null));
        } else {
            this.keyType = keytype;
            final JAXBElement<String> ktElement =
                    (new ObjectFactory()).createKeyType(keyType.toString());
            getAny().add(ktElement);
        }
    
public final voidsetLifetime(Lifetime lifetime)

        this.lifetime = lifetime;
        final JAXBElement<LifetimeType> ltElement =
                (new ObjectFactory()).createLifetime((LifetimeType)lifetime);
        getAny().add(ltElement);
    
public final voidsetOnBehalfOf(OnBehalfOf onBehalfOf)

        obo = onBehalfOf;
    
public final voidsetPolicy(com.sun.xml.ws.policy.Policy policy)

        this.policy = policy;
        getAny().add(policy);
    
public final voidsetPolicyReference(com.sun.xml.ws.policy.impl.bindings.PolicyReference policyRef)

        this.policyRef = policyRef;
        getAny().add(policyRef);
    
public final voidsetProofEncryption(ProofEncryption proofEncryption)

        this.proofEncryption = proofEncryption;
        final JAXBElement<ProofEncryptionType> proofElement =
                (new ObjectFactory()).createProofEncryption((ProofEncryptionType)proofEncryption);
        getAny().add(proofElement);
    
public final voidsetRenewable(Renewing renew)

        renewable = renew;
        final JAXBElement<RenewingType> renewType =
                (new ObjectFactory()).createRenewing((RenewingType)renew);
        getAny().add(renewType);
    
public final voidsetRequestedAttachedReference(RequestedAttachedReference reference)

        requestedAttachedReference = reference;
        final JAXBElement<RequestedReferenceType> raElement =  (new ObjectFactory()).
                createRequestedAttachedReference((RequestedReferenceType)reference);
        getAny().add(raElement);
    
public final voidsetRequestedProofToken(RequestedProofToken proofToken)

        requestedProofToken = proofToken;
        final JAXBElement<RequestedProofTokenType> pElement =  (new ObjectFactory()).
                createRequestedProofToken((RequestedProofTokenType)proofToken);
        getAny().add(pElement);
    
public final voidsetRequestedSecurityToken(RequestedSecurityToken securityToken)

        requestedSecToken = securityToken;
        final JAXBElement<RequestedSecurityTokenType> rstElement =  (new ObjectFactory()).
                createRequestedSecurityToken((RequestedSecurityTokenType)securityToken);
        
        getAny().add(rstElement);
    
public final voidsetRequestedTokenCancelled(RequestedTokenCancelled rtc)

        this.rtc = rtc;
        final JAXBElement<RequestedTokenCancelledType> rtcElement =
                (new ObjectFactory()).createRequestedTokenCancelled((RequestedTokenCancelledType)rtc);
        getAny().add(rtcElement);
    
public final voidsetRequestedUnattachedReference(RequestedUnattachedReference reference)

        requestedUnattachedReference = reference;
        final JAXBElement<RequestedReferenceType> raElement =  (new ObjectFactory()).
                createRequestedUnattachedReference((RequestedReferenceType)reference);
        getAny().add(raElement);
    
public final voidsetSignChallenge(SignChallenge challenge)

        signChallenge = challenge;
        final JAXBElement<SignChallengeType> challengeType =
                (new ObjectFactory()).createSignChallenge((SignChallengeType)challenge);
        getAny().add(challengeType);
    
public final voidsetSignChallengeResponse(SignChallengeResponse challenge)

        signChallengeRes = challenge;
        final JAXBElement<SignChallengeType> challengeType =
                (new ObjectFactory()).createSignChallengeResponse((SignChallengeType)challenge);
        getAny().add(challengeType);
    
public final voidsetSignWith(java.net.URI algorithm)

        signWith = algorithm;
        final JAXBElement<String> sElement =  (new ObjectFactory()).createSignWith(algorithm.toString());
        getAny().add(sElement);
    
public final voidsetSignatureAlgorithm(java.net.URI algorithm)

        signatureAlgorithm = algorithm;
        final JAXBElement<String> signElement =
                (new ObjectFactory()).createSignatureAlgorithm(algorithm.toString());
        getAny().add(signElement);
    
public final voidsetStatus(Status status)

        this.status = status;
        final JAXBElement<StatusType> sElement =
                (new ObjectFactory()).createStatus((StatusType)status);
        getAny().add(sElement);
    
public final voidsetTokenType(java.net.URI tokenType)

        if (tokenType != null) {
            this.tokenType = tokenType;
            final JAXBElement<String> ttElement =
                    (new ObjectFactory()).createTokenType(tokenType.toString());
            getAny().add(ttElement);
        }
    
public final voidsetUseKey(UseKey useKey)

        this.useKey = useKey;
        final JAXBElement<UseKeyType> ukElement =
                (new ObjectFactory()).createUseKey((UseKeyType)useKey);
        getAny().add(ukElement);