//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace System.IdentityModel.Protocols.WSTrust
{
///
/// This class is used to represent the Request Claims collection inside RequestSecurityToken.
/// Indicate whether the claim is optional or not.
///
public class RequestClaim
{
string _claimType;
bool _isOptional;
string _value;
///
/// Instantiates a required RequestClaim instance with ClaimType Uri.
///
/// ClaimType Uri attribute.
public RequestClaim(string claimType)
: this(claimType, false)
{
}
///
/// Instantiates a RequestClaim instance with ClaimType Uri and inidicates whether it is
/// optional.
///
/// The ClaimType Uri attribute.
/// The ClaimType Optional attribute.
public RequestClaim(string claimType, bool isOptional)
: this(claimType, isOptional, null)
{
}
///
/// Instantiates a RequestClaim instance with ClaimType Uri, the flag to inidicate whether it is
/// optional and the value of the request.
///
/// The ClaimType Uri attribute.
/// The ClaimType Optional attribute.
/// The actual value of the claim.
public RequestClaim(string claimType, bool isOptional, string value)
{
if (string.IsNullOrEmpty(claimType))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.ID0006), "claimType"));
}
_claimType = claimType;
_isOptional = isOptional;
_value = value;
}
///
/// Gets ClaimType uri attribute.
///
public string ClaimType
{
get
{
return _claimType;
}
}
///
/// Gets ClaimType optional attribute.
///
public bool IsOptional
{
get
{
return _isOptional;
}
set
{
_isOptional = value;
}
}
///
/// Gets ClaimType value element.
///
public string Value
{
get
{
return _value;
}
set
{
_value = value;
}
}
}
}