//----------------------------------------------------------------------- // // Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------- namespace System.IdentityModel.Protocols.WSTrust { using System.IdentityModel.Tokens; /// /// The class defines the wst:RequestSecurityTokenResponse element which /// is used to return a security token. /// public class RequestSecurityTokenResponse : WSTrustMessage { SecurityKeyIdentifierClause _requestedAttachedReference; RequestedProofToken _requestedProofToken; RequestedSecurityToken _requestedSecurityToken; SecurityKeyIdentifierClause _requestedUnattachedReference; bool _requestedTokenCancelled; Status _status; bool _isFinal = true; /// /// This constructor is usually used on the RSTR receiving end. /// public RequestSecurityTokenResponse() : base() { } /// /// This constructor is usually used on the RSTR sending side. /// /// /// This constructor will copy some information, such as Context, KeyType, /// KeySize and RequestType from the request message. Note here the RequestType /// is not a sub element under RSTR, need it just for token request processing. /// public RequestSecurityTokenResponse(WSTrustMessage message) : base() { if (message == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message"); } RequestType = message.RequestType; // note this is NOT a sub element under RSTR Context = message.Context; KeyType = message.KeyType; if (message.KeySizeInBits > 0 && StringComparer.Ordinal.Equals(message.KeyType, KeyTypes.Symmetric)) { KeySizeInBits = message.KeySizeInBits; } } /// /// Gets or sets the flag that determines if the RSTR is the final message /// and should be serialized as such. /// /// /// This flag is only useful if the version of WS-Trust provides rules for serializing /// the final RSTR in a message flow. For instance, WS-Trust 1.3 requires the final RSTR /// to be enclosed within a RequestSecurityTokenResponseCollection element. /// public bool IsFinal { get { return _isFinal; } set { _isFinal = value; } } /// /// Gets or sets the security token reference when the requested token is attached /// to the message. /// /// /// This optional element is specified to indicate how to reference the returned token when /// that token doesn't support references using URI fragments. /// public SecurityKeyIdentifierClause RequestedAttachedReference { get { return _requestedAttachedReference; } set { _requestedAttachedReference = value; } } /// /// Gets or sets the optional elemnet used to return the requested security token. /// public RequestedSecurityToken RequestedSecurityToken { get { return _requestedSecurityToken; } set { _requestedSecurityToken = value; } } /// /// Gets or sets the optional elemnet used to return the proof of possession token. /// public RequestedProofToken RequestedProofToken { get { return _requestedProofToken; } set { _requestedProofToken = value; } } /// /// Gets or sets the security token reference when the requested token is not attached /// to the message. /// /// /// This optional element is specified to indicate how to reference the returned token when /// that token is not placed in the message. /// public SecurityKeyIdentifierClause RequestedUnattachedReference { get { return _requestedUnattachedReference; } set { _requestedUnattachedReference = value; } } /// /// Gets or sets the RequestedTokenCancelled element. /// public bool RequestedTokenCancelled { get { return _requestedTokenCancelled; } set { _requestedTokenCancelled = value; } } /// /// Gets or sets the Status element in the RSTR. /// public Status Status { get { return _status; } set { _status = value; } } } }