Esempio n. 1
0
        protected internal override void Read(string xml, bool validateXmlSignature = false)
        {
            base.Read(xml, validateXmlSignature);

            ForceAuthn = XmlDocument.DocumentElement.Attributes[Saml2Constants.Message.ForceAuthn].GetValueOrNull <bool>();

            IsPassive = XmlDocument.DocumentElement.Attributes[Saml2Constants.Message.IsPassive].GetValueOrNull <bool>();

            AssertionConsumerServiceUrl = XmlDocument.DocumentElement[Saml2Constants.Message.AssertionConsumerServiceURL, Saml2Constants.AssertionNamespace.OriginalString].GetValueOrNull <Uri>();

            Subject = XmlDocument.DocumentElement[Saml2Constants.Message.Subject, Saml2Constants.AssertionNamespace.OriginalString].GetElementOrNull <Subject>();

            NameIdPolicy = XmlDocument.DocumentElement[Saml2Constants.Message.NameIdPolicy, Saml2Constants.ProtocolNamespace.OriginalString].GetElementOrNull <NameIdPolicy>();

            RequestedAuthnContext = XmlDocument.DocumentElement[Saml2Constants.Message.RequestedAuthnContext, Saml2Constants.ProtocolNamespace.OriginalString].GetElementOrNull <RequestedAuthnContext>();
        }
Esempio n. 2
0
        protected override IEnumerable <XObject> GetXContent()
        {
            if (ForceAuthn.HasValue)
            {
                yield return(new XAttribute(Saml2Constants.Message.ForceAuthn, ForceAuthn));
            }

            if (IsPassive.HasValue)
            {
                yield return(new XAttribute(Saml2Constants.Message.IsPassive, IsPassive));
            }

            if (AssertionConsumerServiceUrl != null)
            {
                yield return(new XAttribute(Saml2Constants.Message.AssertionConsumerServiceURL, AssertionConsumerServiceUrl));
            }

            if (ProtocolBinding != null)
            {
                yield return(new XAttribute(Saml2Constants.Message.ProtocolBinding, ProtocolBinding));
            }

            if (Conditions != null)
            {
                yield return(Conditions.ToXElement());
            }

            if (Subject != null)
            {
                yield return(Subject.ToXElement());
            }

            if (NameIdPolicy != null)
            {
                yield return(NameIdPolicy.ToXElement());
            }

            if (RequestedAuthnContext != null)
            {
                yield return(RequestedAuthnContext.ToXElement());
            }
        }