use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class AuthnStatementAssertionValidatorTest method validate_shouldThrowExceptionIfAuthnContextClassRefIsAbsent.
@Test
public void validate_shouldThrowExceptionIfAuthnContextClassRefIsAbsent() throws Exception {
AuthnContext authnContext = AuthnContextBuilder.anAuthnContext().withAuthnContextClassRef(null).build();
AuthnStatement authnStatement = AuthnStatementBuilder.anAuthnStatement().withAuthnContext(authnContext).build();
Assertion assertion = AssertionBuilder.anAssertion().addAuthnStatement(authnStatement).buildUnencrypted();
validateFail(() -> validator.validate(assertion), authnContextClassRefMissing());
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class AuthnStatementAssertionValidatorTest method validate_shouldThrowExceptionIfAuthnContextClassRefValueIsAbsent.
@Test
public void validate_shouldThrowExceptionIfAuthnContextClassRefValueIsAbsent() throws Exception {
AuthnContextClassRef authnContextClassRef = AuthnContextClassRefBuilder.anAuthnContextClassRef().withAuthnContextClasRefValue(null).build();
AuthnContext authnContext = AuthnContextBuilder.anAuthnContext().withAuthnContextClassRef(authnContextClassRef).build();
AuthnStatement authnStatement = AuthnStatementBuilder.anAuthnStatement().withAuthnContext(authnContext).build();
Assertion assertion = AssertionBuilder.anAssertion().addAuthnStatement(authnStatement).buildUnencrypted();
validateFail(() -> validator.validate(assertion), authnContextClassRefValueMissing());
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class AuthnStatementAssertionValidatorTest method validate_shouldThrowExceptionIfAuthnInstantIsAbsent.
@Test
public void validate_shouldThrowExceptionIfAuthnInstantIsAbsent() {
AuthnStatement authnStatement = AuthnStatementBuilder.anAuthnStatement().withAuthnInstant(null).build();
Assertion assertion = AssertionBuilder.anAssertion().addAuthnStatement(authnStatement).buildUnencrypted();
validateFail(() -> validator.validate(assertion), authnInstantMissing());
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class IPAddressValidatorTest method validate_shouldNotThrowWhenSecondAttributeStatementContainsAnIPAddressAttribute.
@Test
public void validate_shouldNotThrowWhenSecondAttributeStatementContainsAnIPAddressAttribute() throws Exception {
Assertion assertion = anAssertion().addAttributeStatement(anAttributeStatement().build()).addAttributeStatement(anAttributeStatement().addAttribute(IPAddressAttributeBuilder.anIPAddress().build()).build()).buildUnencrypted();
validator.validate(assertion);
}
use of org.opensaml.saml.saml1.core.Assertion in project verify-hub by alphagov.
the class IPAddressValidatorTest method validate_shouldNotThrowWhenFirstAttributeStatementContainsMultipleAttributesIncludingIPAddressAttribute.
@Test
public void validate_shouldNotThrowWhenFirstAttributeStatementContainsMultipleAttributesIncludingIPAddressAttribute() throws Exception {
Assertion assertion = anAssertion().addAttributeStatement(anAttributeStatement().addAttribute(aPersonName_1_1().buildAsFirstname()).addAttribute(IPAddressAttributeBuilder.anIPAddress().build()).build()).buildUnencrypted();
validator.validate(assertion);
}
Aggregations