protected override string[] GetAttributeValuesByName(SamlAttributeName name) { 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.Name != null && a.Name.Equals(name.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); }
protected override string GetAttributeValueByName(SamlAttributeName name) { var attributeValues = GetAttributeValuesByName(name); return(attributeValues != null ? attributeValues.FirstOrDefault() : null); }
public static string AsString(this SamlAttributeName nameEnum) { switch (nameEnum) { case SamlAttributeName.DisplayName: return(DisplayName); default: return(null); } }
protected abstract string[] GetAttributeValuesByName(SamlAttributeName name);
protected override string GetAttributeValueByName(SamlAttributeName name) { var attributeValues = GetAttributeValuesByName(name); return attributeValues != null ? attributeValues.FirstOrDefault() : null; }
protected override string[] GetAttributeValuesByName(SamlAttributeName name) { 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.Name != null && a.Name.Equals(name.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; }