Ejemplo n.º 1
0
        public SamlName(XmlElement element)
        {
            // TODO -- read BaseID
            // TODO -- read EncryptedID

            // TODO -- add NameQualifier as URI
            // TODO -- add SPNameQualifier as URI

            var name = element.FindChild(NameID, AssertionXsd);
            if (name != null)
            {
                Type = SamlNameType.NameID;
                Value = name.InnerText;
                Format = NameFormat.Get(name.GetAttribute(FormatAtt)) ?? NameFormat.Unspecified;
            }
        }
 /// <summary>
 /// Read an element whose text is to be interpretted as a bool and
 /// return the result.
 /// </summary>
 private bool ReadBool(XmlElement root, string elementName, bool defaultVal = false)
 {
     var element = root.FindChild(elementName);
     if (element == null)
         return defaultVal;
     else
     {
         try
         {
             return Convert.ToBoolean(element.InnerText.ToLower());
         }
         catch (FormatException)
         {
             Debug_CouldNotParseBool(elementName, element.InnerText, defaultVal);
             return defaultVal;
         }
     }
 }