//-----------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------
namespace System.IdentityModel.Tokens
{
using System;
using System.Collections.ObjectModel;
///
/// Represents the NameID element as specified in [Saml2Core, 2.2.3].
///
public class Saml2NameIdentifier
{
private Uri format;
private string nameQualifier;
private string serviceProviderPointNameQualifier;
private string serviceProviderdId;
private string value;
private EncryptingCredentials encryptingCredentials;
private Collection externalEncryptedKeys;
///
/// Initializes an instance of from a name.
///
/// Name string to initialize with.
public Saml2NameIdentifier(string name)
: this(name, null)
{
}
///
/// Initializes an instance of from a name and format.
///
/// Name string to initialize with.
/// specifying the identifier format.
public Saml2NameIdentifier(string name, Uri format)
{
if (string.IsNullOrEmpty(name))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("name");
}
if (null != format && !format.IsAbsoluteUri)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("format", SR.GetString(SR.ID0013));
}
this.format = format;
this.value = name;
this.externalEncryptedKeys = new Collection();
}
///
/// Gets or sets the used for encrypting.
///
public EncryptingCredentials EncryptingCredentials
{
get { return this.encryptingCredentials; }
set { this.encryptingCredentials = value; }
}
///
/// Gets additional encrypted keys which will be specified external to the
/// EncryptedData element, as children of the EncryptedId element.
///
public Collection ExternalEncryptedKeys
{
get { return this.externalEncryptedKeys; }
}
///
/// Gets or sets a URI reference representing the classification of string-based identifier
/// information. [Saml2Core, 2.2.2]
///
public Uri Format
{
get
{
return this.format;
}
set
{
if (null != value && !value.IsAbsoluteUri)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("value", SR.GetString(SR.ID0013));
}
this.format = value;
}
}
///
/// Gets or sets the security or administrative domain that qualifies the name. [Saml2Core, 2.2.2]
///
public string NameQualifier
{
get { return this.nameQualifier; }
set { this.nameQualifier = XmlUtil.NormalizeEmptyString(value); }
}
///
/// Gets or sets a name that further qualifies the name of a service provider or affiliation
/// of providers. [Saml2Core, 2.2.2]
///
public string SPNameQualifier
{
get { return this.serviceProviderPointNameQualifier; }
set { this.serviceProviderPointNameQualifier = XmlUtil.NormalizeEmptyString(value); }
}
///
/// Gets or sets a name identifier established by a service provider or affiliation of providers
/// for the entity, if different from the primary name identifier. [Saml2Core, 2.2.2]
///
public string SPProvidedId
{
get { return this.serviceProviderdId; }
set { this.serviceProviderdId = XmlUtil.NormalizeEmptyString(value); }
}
///
/// Gets or sets the value of the name identifier.
///
public string Value
{
get
{
return this.value;
}
set
{
if (string.IsNullOrEmpty(value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
}
this.value = value;
}
}
}
}