SamlAttribute Constructors
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the SamlAttribute class.
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. |
Initializes a new instance of the SamlAttribute class.
public:
SamlAttribute();
public SamlAttribute ();
Public Sub New ()
Applies to
.NET Framework 4.8.1 and other versions
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
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
.NET Framework 4.8.1 and other versions
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
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
.NET Framework 4.8.1 and other versions
Product | Versions |
---|---|
.NET Framework | 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: