Example #1
0
            public void ThrowsExceptionWhenSubjectConfirmationContainsElementsOfWrongIdentifier()
            {
                // Arrange
                var saml20Assertion = AssertionUtil.GetBasicAssertion();

                saml20Assertion.Subject.Items = new object[] { string.Empty, 24, new List <object>(1), new Advice() };

                var validator = new Saml20SubjectValidator();

                // Act
                validator.ValidateSubject(saml20Assertion.Subject);
            }
Example #2
0
            public void ThrowsExceptionWhenSubjectConfirmationDoesNotContainSubject()
            {
                // Arrange
                var saml20Assertion = AssertionUtil.GetBasicAssertion();

                saml20Assertion.Subject.Items = new object[] { };

                var validator = new Saml20SubjectValidator();

                // Act
                validator.ValidateSubject(saml20Assertion.Subject);
            }
Example #3
0
            public void ThrowsExceptionWhenSubjectConfirmationContainsElementsOfWrongIdentifier()
            {
                // Arrange
                var saml20Assertion = AssertionUtil.GetBasicAssertion();

                saml20Assertion.Subject.Items = new object[] { string.Empty, 24, new List <object>(1), new Advice() };

                var validator = new Saml20SubjectValidator();

                // Act
                Assert.Throws <Saml20FormatException>(() => validator.ValidateSubject(saml20Assertion.Subject),
                                                      "Subject must have either NameID, EncryptedID or SubjectConfirmation subelement.");
            }
Example #4
0
            public void ThrowsExceptionWhenSubjectConfirmationDoesNotContainSubject()
            {
                // Arrange
                var saml20Assertion = AssertionUtil.GetBasicAssertion();

                saml20Assertion.Subject.Items = new object[] { };

                var validator = new Saml20SubjectValidator();

                // Act
                Assert.Throws <Saml20FormatException>(() => validator.ValidateSubject(saml20Assertion.Subject),
                                                      "Subject MUST contain either an identifier or a subject confirmation");
            }