แก้ไข

แชร์ผ่าน


SamlAttribute Constructors

Definition

Initializes a new instance of the SamlAttribute class.

Overloads

SamlAttribute()

Initializes a new instance of the SamlAttribute class.

SamlAttribute(Claim)

Initializes a new instance of the SamlAttribute class using the specified claim.

SamlAttribute(String, String, IEnumerable<String>)

Initializes a new instance of the SamlAttribute class using the specified attribute name, XML namespace, and attribute values.

SamlAttribute()

Initializes a new instance of the SamlAttribute class.

public:
 SamlAttribute();
public SamlAttribute ();
Public Sub New ()

Applies to

SamlAttribute(Claim)

Initializes a new instance of the SamlAttribute class using the specified claim.

public:
 SamlAttribute(System::IdentityModel::Claims::Claim ^ claim);
public SamlAttribute (System.IdentityModel.Claims.Claim claim);
new System.IdentityModel.Tokens.SamlAttribute : System.IdentityModel.Claims.Claim -> System.IdentityModel.Tokens.SamlAttribute
Public Sub New (claim As Claim)

Parameters

claim
Claim

A Claim that represents an attribute of the subject for a SamlSecurityToken security token.

Exceptions

claim is null.

The Resource property of claim is not of type String.

-or-

The Right property of claim is not PossessProperty.

-or-

The ClaimType property of claim does not have a '/' character or it is in the first or last index positions.

Remarks

Use this constructor to convert a claim into a SAML attribute. To be converted to a SAML attribute, the Right property must be PossessProperty, the Resource property must be of type String, and the ClaimType property must be in the format namespace/name.

The following table specifies what the claim parameter sets the Name, Namespace, and the AttributeValues properties to.

Property Property of the claim parameter used to set the property
AttributeValues The value of the Resource property is added to the collection.
Name The portion of the string after the last '/' character in the ClaimType property.
Namespace The portion of the string before the last '/' character in the ClaimType property.

Applies to

SamlAttribute(String, String, IEnumerable<String>)

Initializes a new instance of the SamlAttribute class using the specified attribute name, XML namespace, and attribute values.

public:
 SamlAttribute(System::String ^ attributeNamespace, System::String ^ attributeName, System::Collections::Generic::IEnumerable<System::String ^> ^ attributeValues);
public SamlAttribute (string attributeNamespace, string attributeName, System.Collections.Generic.IEnumerable<string> attributeValues);
new System.IdentityModel.Tokens.SamlAttribute : string * string * seq<string> -> System.IdentityModel.Tokens.SamlAttribute
Public Sub New (attributeNamespace As String, attributeName As String, attributeValues As IEnumerable(Of String))

Parameters

attributeNamespace
String

The XML namespace in which the attributeName parameter is defined.

attributeName
String

The name of the SAML attribute.

attributeValues
IEnumerable<String>

An IEnumerable<T> that contains the values of the SAML attribute.

Exceptions

attributeNamespace is null.

-or-

attributeName is null.

-or-

attributeValues is null.

The Resource property of claim is not of type String.

-or-

The Right property of claim is not PossessProperty.

-or-

The ClaimType property of claim does not have a '/' character or it is in the first or last index positions.

Remarks

The following table specifies the properties that are set by this constructor's parameters.

Property Parameter
AttributeValues attributeValues
Name attributeName
Namespace attributeNamespace

Applies to