protected override string[] GetAttributeValuesByFriendlyName(SamlAttributeFriendlyName friendlyName)
 {
     if (Assertion != null)
     {
         var attributeStatement = Assertion.Statements.OfType<AttributeStatement>().SingleOrDefault();
         if (attributeStatement != null)
         {
             if (attributeStatement.GetUnencryptedAttributes().Count > 0)
             {
                 var attributes = attributeStatement.GetUnencryptedAttributes();
                 var attribute = attributes.SingleOrDefault(a => a.FriendlyName != null &&
                     a.FriendlyName.Equals(friendlyName.AsString(), StringComparison.OrdinalIgnoreCase));
                 if (attribute != null && attribute.Values.Count > 0 && attribute.Values[0].Data != null)
                 {
                     return
                     (
                         from value in attribute.Values
                         where value != null && value.Data != null
                         select value.Data.ToString()
                     )
                     .ToArray();
                 }
             }
         }
     }
     return null;
 }
示例#2
0
 protected override string[] GetAttributeValuesByFriendlyName(SamlAttributeFriendlyName friendlyName)
 {
     if (Assertion != null)
     {
         var attributeStatement = Assertion.Statements.OfType <AttributeStatement>().SingleOrDefault();
         if (attributeStatement != null)
         {
             if (attributeStatement.GetUnencryptedAttributes().Count > 0)
             {
                 var attributes = attributeStatement.GetUnencryptedAttributes();
                 var attribute  = attributes.SingleOrDefault(a => a.FriendlyName != null &&
                                                             a.FriendlyName.Equals(friendlyName.AsString(), StringComparison.OrdinalIgnoreCase));
                 if (attribute != null && attribute.Values.Count > 0 && attribute.Values[0].Data != null)
                 {
                     return
                         ((
                              from value in attribute.Values
                              where value != null && value.Data != null
                              select value.Data.ToString()
                              )
                          .ToArray());
                 }
             }
         }
     }
     return(null);
 }