public void ReturnsStringFor_EduPersonPrincipalNameEnum() { const SamlAttributeFriendlyName friendlyNameEnum = SamlAttributeFriendlyName.EduPersonPrincipalName; var friendlyNameString = friendlyNameEnum.AsString(); friendlyNameString.ShouldEqual("eduPersonPrincipalName"); }
public static string AsString(this SamlAttributeFriendlyName friendlyNameEnum) { switch (friendlyNameEnum) { case SamlAttributeFriendlyName.EduPersonTargetedId: return(EduPersonTargetedId); case SamlAttributeFriendlyName.EduPersonPrincipalName: return(EduPersonPrincipalName); case SamlAttributeFriendlyName.EduPersonScopedAffiliation: return(EduPersonScopedAffiliation); case SamlAttributeFriendlyName.CommonName: return(CommonName); case SamlAttributeFriendlyName.SurName: return(SurName); case SamlAttributeFriendlyName.GivenName: return(GivenName); case SamlAttributeFriendlyName.Mail: return(Mail); default: return(null); } }
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); }
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; }
protected override string GetAttributeValueByFriendlyName(SamlAttributeFriendlyName friendlyName) { var attributeValues = GetAttributeValuesByFriendlyName(friendlyName); return attributeValues != null ? attributeValues.FirstOrDefault() : null; }
protected override string GetAttributeValueByFriendlyName(SamlAttributeFriendlyName friendlyName) { var attributeValues = GetAttributeValuesByFriendlyName(friendlyName); return(attributeValues != null ? attributeValues.FirstOrDefault() : null); }
protected abstract string[] GetAttributeValuesByFriendlyName(SamlAttributeFriendlyName friendlyName);