use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class HubAssertionMarshallerTest method transform_shouldTransformAssertionIssuerInstance.
@Test
public void transform_shouldTransformAssertionIssuerInstance() {
DateTime issueInstant = DateTime.parse("2012-12-31T12:34:56Z");
HubAssertion assertion = aHubAssertion().withIssueInstant(issueInstant).build();
Assertion transformedAssertion = marshaller.toSaml(assertion);
assertThat(transformedAssertion.getIssueInstant()).isEqualTo(issueInstant);
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class HubAssertionMarshallerTest method transform_shouldTransformAssertionIssuer.
@Test
public void transform_shouldTransformAssertionIssuer() {
String assertionIssuerId = "assertion issuer";
HubAssertion assertion = aHubAssertion().withIssuerId(assertionIssuerId).build();
Assertion transformedAssertion = marshaller.toSaml(assertion);
assertThat(transformedAssertion.getIssuer().getValue()).isEqualTo(assertionIssuerId);
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class HubAssertionMarshallerTest method transform_shouldTransformCycle3DataAssertion.
@Test
public void transform_shouldTransformCycle3DataAssertion() {
String attributeName = "someName";
String value = "some value";
HubAssertion assertion = aHubAssertion().withCycle3Data(aCycle3Dataset().addCycle3Data(attributeName, value).build()).build();
Attribute expectedAttribute = aSimpleStringAttribute().build();
when(attributeFactory.createCycle3DataAttribute(attributeName, value)).thenReturn(expectedAttribute);
Assertion transformedAssertion = marshaller.toSaml(assertion);
List<AttributeStatement> attributeStatements = transformedAssertion.getAttributeStatements();
assertThat(attributeStatements.size()).isGreaterThan(0);
Attribute attribute = attributeStatements.get(0).getAttributes().get(0);
assertThat(attribute).isEqualTo(expectedAttribute);
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class DuplicateAssertionValidatorTest method validateMatchingDataSetAssertion_shouldPassIfTwoAssertionsHaveTheSameIdButTheFirstAssertionHasExpired.
@Test
public void validateMatchingDataSetAssertion_shouldPassIfTwoAssertionsHaveTheSameIdButTheFirstAssertionHasExpired() throws Exception {
DateTime futureDate = DateTime.now().plusMinutes(6);
Assertion assertion = createAssertion("expired-duplicate", futureDate);
duplicateAssertionValidator.validateMatchingDataSetAssertion(assertion, "issuer");
assertThat(duplicateIds.get("expired-duplicate")).isEqualTo(futureDate.toDateTime(UTC));
}
use of org.opensaml.saml2.core.Assertion in project verify-hub by alphagov.
the class DuplicateAssertionValidatorTest method validateAuthnStatementAssertion_shouldPassIfTheAssertionIsNotADuplicateOfAPreviousOne.
@Test
public void validateAuthnStatementAssertion_shouldPassIfTheAssertionIsNotADuplicateOfAPreviousOne() throws Exception {
Assertion assertion = anAssertion().withId("not-duplicate").buildUnencrypted();
duplicateAssertionValidator.validateAuthnStatementAssertion(assertion);
}
Aggregations