Inheritance: ISaml20SubjectConfirmationDataValidator
Ejemplo n.º 1
0
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_IncompleteAnyElement_NoChildren()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";
            XmlDocument doc = new XmlDocument();
            subjectConfirmationData.AnyElements = new XmlElement[] { doc.CreateElement("ds", "KeyInfo", Saml20Constants.XMLDSIG) };

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
Ejemplo n.º 2
0
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_WrongAnyElement()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";
            XmlDocument doc = new XmlDocument();
            XmlElement elem = doc.CreateElement("ds", "KeyInfo", "http://wrongNameSpace.uri");
            elem.AppendChild((doc.CreateElement("ds", "KeyName", Saml20Constants.XMLDSIG)));

            subjectConfirmationData.AnyElements = new XmlElement[] { elem };

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
Ejemplo n.º 3
0
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_NoAnyElement()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
Ejemplo n.º 4
0
        public void SubjectConfirmationData_Invalid_KeyInfoConfirmationData_IncompleteAnyElement()
        {
            KeyInfoConfirmationData subjectConfirmationData = new KeyInfoConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";
            XmlDocument doc = new XmlDocument();
            subjectConfirmationData.AnyElements = new XmlElement[] { doc.CreateElement("ds", "KeyInfo", "http://wrongNameSpace.uri") };

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
Ejemplo n.º 5
0
        public void SubjectConfirmationDataValidTimeIntervalSettings()
        {
            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();

            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.NotBefore = new DateTime(2008, 01, 30, 17, 13, 0, 500, DateTimeKind.Utc);
            subjectConfirmationData.NotOnOrAfter = subjectConfirmationData.NotBefore.Value.AddHours(1);

            validator.ValidateSubjectConfirmationData(subjectConfirmationData);

            subjectConfirmationData.NotBefore = null;
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);

            // DateTime validation wrt DateTime.UtcNow is NOT done by the validators
            // so a future-NotBefore must be valid
            subjectConfirmationData.NotBefore = subjectConfirmationData.NotOnOrAfter;
            subjectConfirmationData.NotOnOrAfter = null;
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);

            subjectConfirmationData.NotBefore = null;
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
Ejemplo n.º 6
0
        public void SubjectConfirmationDataInvalidTimeInterval()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.NotBefore = new DateTime(2008, 01, 30, 17, 13, 0, 500, DateTimeKind.Utc);
            subjectConfirmationData.NotOnOrAfter = subjectConfirmationData.NotBefore.Value.AddHours(-1);

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
Ejemplo n.º 7
0
        public void SubjectConfirmationDataValidRecipient()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.Recipient = "urn:wellformed.uri:ok";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);


        }
Ejemplo n.º 8
0
        public void SubjectConfirmationDataInvalidRecipient()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.Recipient = "malformed uri";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }
Ejemplo n.º 9
0
        public void SubjectConfirmationDataEmptyRecipient()
        {
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.Recipient = " ";

            Saml20SubjectConfirmationDataValidator validator = new Saml20SubjectConfirmationDataValidator();
            validator.ValidateSubjectConfirmationData(subjectConfirmationData);
        }