use of uk.gov.ida.saml.core.domain.HubAssertion in project verify-hub by alphagov.
the class HubAssertionMarshallerTest method transform_shouldTransformAssertionSubjects.
@Test
public void transform_shouldTransformAssertionSubjects() {
HubAssertion assertion = aHubAssertion().build();
marshaller.toSaml(assertion);
verify(outboundAssertionToSubjectTransformer).transform(assertion);
}
use of uk.gov.ida.saml.core.domain.HubAssertion 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 uk.gov.ida.saml.core.domain.HubAssertion 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 uk.gov.ida.saml.core.domain.HubAssertion 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 uk.gov.ida.saml.core.domain.HubAssertion in project verify-hub by alphagov.
the class HubAttributeQueryRequestToSamlAttributeQueryTransformerTest method transform_shouldSetTheSPNameQualifierAndNameQualifierToValuesThatShouldntBeThereButCurrentlyHaveNoWhereBetterToBe.
@Test
public void transform_shouldSetTheSPNameQualifierAndNameQualifierToValuesThatShouldntBeThereButCurrentlyHaveNoWhereBetterToBe() {
final String authnStatementAssertion = aPassthroughAssertion().withUnderlyingAssertion(ENCRYPTED_AUTHN_ASSERTION).buildAuthnStatementAssertionAsString();
final HubAssertion cycle3DataAssertion = aHubAssertion().build();
HubAttributeQueryRequest originalQuery = aHubAttributeQueryRequest().withEncryptedAuthnAssertion(authnStatementAssertion).withCycle3DataAssertion(cycle3DataAssertion).withAssertionConsumerServiceUrl(URI.create("/foo")).withAuthnRequestIssuerEntityId("authn-request-issuer").build();
AttributeQuery transformedQuery = transformer.apply(originalQuery);
NameID nameID = transformedQuery.getSubject().getNameID();
assertThat(nameID.getSPNameQualifier()).isEqualTo("authn-request-issuer");
assertThat(nameID.getNameQualifier()).isEqualTo("/foo");
}
Aggregations