//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace System.IdentityModel.Protocols.WSTrust
{
///
/// Defines the auth:ContextItem element.
///
public class ContextItem
{
Uri _name;
Uri _scope;
string _value;
///
/// Initializes an instance of
///
/// Context item name.
public ContextItem(Uri name)
: this(name, null)
{
}
///
/// Initializes an instance of
///
/// Context item name.
/// Context item value. Can be null.
public ContextItem(Uri name, string value)
: this(name, value, null)
{
}
///
/// Initializes an instance of
///
/// Context item name.
/// Context item value. Can be null.
/// Context item scope. Can be null.
/// Input argument 'name' is null.
/// Input argument 'name' or 'scope' is not an absolute URI.
public ContextItem(Uri name, string value, Uri scope)
{
if (name == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
}
if (!name.IsAbsoluteUri)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("name", SR.GetString(SR.ID0013));
}
if ((scope != null) && !scope.IsAbsoluteUri)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("scope", SR.GetString(SR.ID0013));
}
_name = name;
_scope = scope;
_value = value;
}
///
/// Gets the name of the item.
///
public Uri Name
{
get { return _name; }
set { _name = value; }
}
///
/// Gets the Scope of the item.
///
public Uri Scope
{
get { return _scope; }
set
{
if ((value != null) && !value.IsAbsoluteUri)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.GetString(SR.ID0013));
}
_scope = value;
}
}
///
/// Gets the value of the item.
///
public string Value
{
get { return _value; }
set { _value = value; }
}
}
}