1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
//-----------------------------------------------------------------------
// <copyright file="Saml2NameIdentifier.cs" company="Microsoft">
// Copyright (c) Microsoft Corporation. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace System.IdentityModel.Tokens
{
using System;
using System.Collections.ObjectModel;
/// <summary>
/// Represents the NameID element as specified in [Saml2Core, 2.2.3].
/// </summary>
public class Saml2NameIdentifier
{
private Uri format;
private string nameQualifier;
private string serviceProviderPointNameQualifier;
private string serviceProviderdId;
private string value;
private EncryptingCredentials encryptingCredentials;
private Collection<EncryptedKeyIdentifierClause> externalEncryptedKeys;
/// <summary>
/// Initializes an instance of <see cref="Saml2NameIdentifier"/> from a name.
/// </summary>
/// <param name="name">Name string to initialize with.</param>
public Saml2NameIdentifier(string name)
: this(name, null)
{
}
/// <summary>
/// Initializes an instance of <see cref="Saml2NameIdentifier"/> from a name and format.
/// </summary>
/// <param name="name">Name string to initialize with.</param>
/// <param name="format"><see cref="Uri"/> specifying the identifier format.</param>
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<EncryptedKeyIdentifierClause>();
}
/// <summary>
/// Gets or sets the <see cref="EncryptingCredentials"/> used for encrypting.
/// </summary>
public EncryptingCredentials EncryptingCredentials
{
get { return this.encryptingCredentials; }
set { this.encryptingCredentials = value; }
}
/// <summary>
/// Gets additional encrypted keys which will be specified external to the
/// EncryptedData element, as children of the EncryptedId element.
/// </summary>
public Collection<EncryptedKeyIdentifierClause> ExternalEncryptedKeys
{
get { return this.externalEncryptedKeys; }
}
/// <summary>
/// Gets or sets a URI reference representing the classification of string-based identifier
/// information. [Saml2Core, 2.2.2]
/// </summary>
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;
}
}
/// <summary>
/// Gets or sets the security or administrative domain that qualifies the name. [Saml2Core, 2.2.2]
/// </summary>
public string NameQualifier
{
get { return this.nameQualifier; }
set { this.nameQualifier = XmlUtil.NormalizeEmptyString(value); }
}
/// <summary>
/// Gets or sets a name that further qualifies the name of a service provider or affiliation
/// of providers. [Saml2Core, 2.2.2]
/// </summary>
public string SPNameQualifier
{
get { return this.serviceProviderPointNameQualifier; }
set { this.serviceProviderPointNameQualifier = XmlUtil.NormalizeEmptyString(value); }
}
/// <summary>
/// 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]
/// </summary>
public string SPProvidedId
{
get { return this.serviceProviderdId; }
set { this.serviceProviderdId = XmlUtil.NormalizeEmptyString(value); }
}
/// <summary>
/// Gets or sets the value of the name identifier.
/// </summary>
public string Value
{
get
{
return this.value;
}
set
{
if (string.IsNullOrEmpty(value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("value");
}
this.value = value;
}
}
}
}
|