SamlAttribute Class 
Definition
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.
Represents an attribute that is associated with the subject of a SamlAttributeStatement.
public ref class SamlAttributepublic class SamlAttributetype SamlAttribute = classPublic Class SamlAttribute- Inheritance
- 
				SamlAttribute
Examples
protected override Collection<SamlAttribute> GetIssuedClaims(RequestSecurityToken RST)
{
    EndpointAddress rstAppliesTo = RST.AppliesTo;
    if (rstAppliesTo == null)
    {
        throw new InvalidOperationException("No AppliesTo EndpointAddress in RequestSecurityToken");
    }
    string bookName = rstAppliesTo.Headers.FindHeader(Constants.BookNameHeaderName, Constants.BookNameHeaderNamespace).GetValue<string>();
    if (string.IsNullOrEmpty(bookName))
        throw new FaultException("The book name was not specified in the RequestSecurityToken");
    EnsurePurchaseLimitSufficient(bookName);
    Collection<SamlAttribute> samlAttributes = new Collection<SamlAttribute>();
    foreach (ClaimSet claimSet in ServiceSecurityContext.Current.AuthorizationContext.ClaimSets)
    {
        // Copy Name claims from the incoming credentials into the set of claims to be issued.
        IEnumerable<Claim> nameClaims = claimSet.FindClaims(ClaimTypes.Name, Rights.PossessProperty);
        if (nameClaims != null)
        {
            foreach (Claim nameClaim in nameClaims)
            {
                samlAttributes.Add(new SamlAttribute(nameClaim));
            }
        }
    }
    // Add a purchase authorized claim.
    samlAttributes.Add(new SamlAttribute(new Claim(Constants.PurchaseAuthorizedClaim, bookName, Rights.PossessProperty)));
    return samlAttributes;
}
Protected Overrides Function GetIssuedClaims(ByVal RST As RequestSecurityToken) As Collection(Of SamlAttribute)
    Dim rstAppliesTo As EndpointAddress = RST.AppliesTo
    If rstAppliesTo Is Nothing Then
        Throw New InvalidOperationException("No AppliesTo EndpointAddress in RequestSecurityToken")
    End If
    Dim bookName As String = rstAppliesTo.Headers.FindHeader(Constants.BookNameHeaderName, Constants.BookNameHeaderNamespace).GetValue(Of String)()
    If String.IsNullOrEmpty(bookName) Then
        Throw New FaultException("The book name was not specified in the RequestSecurityToken")
    End If
    EnsurePurchaseLimitSufficient(bookName)
    Dim samlAttributes As New Collection(Of SamlAttribute)()
    Dim claimSet As ClaimSet
    For Each claimSet In ServiceSecurityContext.Current.AuthorizationContext.ClaimSets
        ' Copy Name claims from the incoming credentials into the set of claims we're going to issue
        Dim nameClaims As IEnumerable(Of Claim) = claimSet.FindClaims(ClaimTypes.Name, Rights.PossessProperty)
        If Not (nameClaims Is Nothing) Then
            Dim nameClaim As Claim
            For Each nameClaim In nameClaims
                samlAttributes.Add(New SamlAttribute(nameClaim))
            Next nameClaim
        End If
    Next claimSet
    ' add a purchase authorized claim
    samlAttributes.Add(New SamlAttribute(New Claim(Constants.PurchaseAuthorizedClaim, bookName, Rights.PossessProperty)))
    Return samlAttributes
End Function
Remarks
The SamlAttribute class corresponds to the <saml:Attribute> XML element that is defined in the OASIS SAML 1.1 specification.
A SamlAttribute instance contains PossessProperty claims for the subject of a SamlAttributeStatement. For example, a SamlAttribute might contain an Over21 claim, whose type would be specified in the Namespace property and whose resource would be specified as a member of the collection in the AttributeValues property. When the CreatePolicy method is called, this Over21 claim is added to the authorization policy that is returned by returned from by the SamlAttributeStatement. When the AttributeValues property contains multiple elements then one claim is returned for each element.
SamlAttribute position in the SAML object hierarchy is:
Constructors
| 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. | 
Properties
| AttributeValues | Gets a collection of attribute values for the SAML attribute. | 
| AttributeValueXsiType | Gets or sets the xsi:type of the values contained in the SAML Attribute. | 
| IsReadOnly | Gets a value that indicates whether the properties of this instance are read-only. | 
| Name | Gets or sets the name of the SAML attribute. | 
| Namespace | Gets or sets the XML namespace in which the name of the SAML attribute is defined. | 
| OriginalIssuer | Gets or sets the string that represents the OriginalIssuer of the SAML attribute. | 
Methods
| Equals(Object) | Determines whether the specified object is equal to the current object.(Inherited from Object) | 
| ExtractClaims() | Gets a collection of claims that this SAML attribute represents. | 
| GetHashCode() | Serves as the default hash function.(Inherited from Object) | 
| GetType() | Gets the Type of the current instance.(Inherited from Object) | 
| MakeReadOnly() | Causes this instance to be read-only. | 
| MemberwiseClone() | Creates a shallow copy of the current Object.(Inherited from Object) | 
| ReadXml(XmlDictionaryReader, SamlSerializer, SecurityTokenSerializer, SecurityTokenResolver) | Reads the SAML attribute from the specified XML reader. | 
| ToString() | Returns a string that represents the current object.(Inherited from Object) | 
| WriteXml(XmlDictionaryWriter, SamlSerializer, SecurityTokenSerializer) | Writes the SAML attribute into the specified XML serializer. |