Example #1
0
        public static SubjectConfirmationType Load(XElement SubjectConfirmationElement)
        {
            var sc = new SubjectConfirmationType();

            foreach (var a in SubjectConfirmationElement.Attributes())
            {
                switch (a.Name.LocalName)
                {
                case "Method": sc.Method = new Uri(a.Value); break;
                }
            }

            foreach (var e in SubjectConfirmationElement.Elements())
            {
                switch (e.Name.LocalName)
                {
                //case "BaseID": sc.BaseID = BaseIDType.Load(e); break;
                case "NameID": sc.NameID = NameIDType.Load(e); break;

                //case "EncryptedID": sc.EncryptedID = EncryptedIDType.Load(e); break;
                case "ConfirmationMethod": sc.Method = new Uri(e.Value); break;

                case "SubjectConfirmationData": sc.SubjectConfirmationData = SubjectConfirmationDataType.Load(e); break;
                }
            }
            return(sc);
        }
Example #2
0
        public static SubjectType Load(XElement SubjectElement)
        {
            var st = new SubjectType();

            foreach (var e in SubjectElement.Elements())
            {
                switch (e.Name.LocalName)
                {
                //case "BaseID": st.BaseID = BaseIDType.Load(e); break;
                case "NameID": st.NameID = NameIDType.Load(e); break;

                //case "EncryptedID": st.EncryptedID = EncryptedIDType.Load(e); break;
                //case "SubjectConfirmation": st.SubjectConfirmations.Add(new SubjectConfirmationType(e)); break;
                case "SubjectConfirmation": st.SubjectConfirmations.Add(SubjectConfirmationType.Load(e)); break;
                }
            }

            if (st.NameID == null && st.SubjectConfirmations.Count == 0)
            {
                throw new Exception("SubjectType error");
            }

            return(st);
        }