//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace System.IdentityModel.Protocols.WSTrust
{
using System.IdentityModel.Tokens;
using System.Xml;
///
/// This class defines the requested security token which is usually opaque to
/// the token requestor.
///
public class RequestedSecurityToken
{
XmlElement _tokenAsXml;
SecurityToken _requestedToken;
///
/// Creates an instance of RequestedSecurityToken using the issued token. This is usually used
/// on the token issuer end.
///
/// The Security token requested.
public RequestedSecurityToken(SecurityToken token)
{
if (token == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("token");
}
_requestedToken = token;
}
///
/// Creates an instance of RequestedSecurityToken using the token xml. This is usually used on the
/// token receiving end.
///
/// XML representation of the token.
public RequestedSecurityToken(XmlElement tokenAsXml)
{
if (tokenAsXml == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("tokenAsXml");
}
_tokenAsXml = tokenAsXml;
}
///
/// Returns the XML representation of the token when the RequestedSecurityToken was constructed
/// using the token xml. This property getter could return null if the RequestedSecurityToken was constructed
/// using a security token.
///
public virtual XmlElement SecurityTokenXml
{
get
{
return _tokenAsXml;
}
}
///
/// Gets the issued security token when the RequestedSecurityToken was constructed using the token
/// itself. This property getter could return null if the RequestedSecurityToken was constructed using the
/// token xml.
///
public SecurityToken SecurityToken
{
get
{
return _requestedToken;
}
}
}
}