示例#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);
        }
示例#2
0
        public SubjectType(string NameID, Uri NameIDFormat, SubjectConfirmationType st)
        {
            this.NameID = new NameIDType
            {
                Value  = NameID,
                Format = NameIDFormat
            };

            SubjectConfirmations.Add(st);
        }
示例#3
0
        public static NameIDType Load(XElement NameIDElement)
        {
            var bt = new NameIDType();

            foreach (var a in NameIDElement.Attributes())
            {
                switch (a.Name.LocalName)
                {
                case "NameQualifier": bt.NameQualifier = a.Value; break;

                case "SPNameQualifier": bt.SPNameQualifier = a.Value; break;

                case "Format": bt.Format = new Uri(a.Value); break;

                case "SPProvidedID": bt.SPProvidedID = a.Value; break;
                }
            }
            bt.Value = (string)NameIDElement;
            return(bt);
        }
示例#4
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);
        }