use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.
the class IdpIdaStatusUnmarshallerTest method shouldThrowWhenNoMatch.
@Test
public void shouldThrowWhenNoMatch() throws Exception {
Assertions.assertThrows(IllegalStateException.class, () -> {
String xml = readXmlFile("status-unknown.xml");
Response response = stringToOpenSamlObjectTransformer.apply(xml);
getStatusFrom(response);
});
}
use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.
the class IdpIdaStatusUnmarshallerTest method shouldMapSamlStatusDetailOfLoaPendingToAuthenticationPending.
@Test
public void shouldMapSamlStatusDetailOfLoaPendingToAuthenticationPending() throws Exception {
String pendingXml = readXmlFile("status-pending.xml");
Response pendingResponse = stringToOpenSamlObjectTransformer.apply(pendingXml);
IdpIdaStatus idpIdaStatus = getStatusFrom(pendingResponse);
assertThat(idpIdaStatus.getStatusCode()).isEqualTo(IdpIdaStatus.Status.AuthenticationPending);
}
use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.
the class IdpIdaStatusUnmarshallerTest method transform_shouldTransformRequesterErrorWithRequestDeniedSubstatus.
@Test
public void transform_shouldTransformRequesterErrorWithRequestDeniedSubstatus() {
OpenSamlXmlObjectFactory samlObjectFactory = new OpenSamlXmlObjectFactory();
Status status = samlObjectFactory.createStatus();
StatusCode topLevelStatusCode = samlObjectFactory.createStatusCode();
topLevelStatusCode.setValue(StatusCode.REQUESTER);
StatusCode subStatusCode = samlObjectFactory.createStatusCode();
subStatusCode.setValue(StatusCode.REQUEST_DENIED);
status.setStatusCode(topLevelStatusCode);
IdpIdaStatus transformedStatus = unmarshaller.fromSaml(status);
assertThat(transformedStatus).isEqualTo(IdpIdaStatus.requesterError());
}
use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.
the class PassthroughAssertionUnmarshallerTest method transform_shouldThrowExceptionIfGpg45StatusIsNotRecognised.
@Test
public void transform_shouldThrowExceptionIfGpg45StatusIsNotRecognised() {
Assertions.assertThrows(IllegalStateException.class, () -> {
String gpg45Status = "status not known";
Assertion theAssertion = givenAFraudEventAssertion(gpg45Status);
unmarshaller.fromAssertion(theAssertion);
});
}
use of org.opensaml.saml.saml2.core.Status in project verify-hub by alphagov.
the class ProtectiveMonitoringLogFormatter method formatAuthnResponse.
public String formatAuthnResponse(Response samlResponse, Direction direction, SignatureStatus signatureStatus) {
Issuer issuer = samlResponse.getIssuer();
String issuerString = issuer != null ? issuer.getValue() : "";
Status status = samlResponse.getStatus();
StatusCode subStatusCode = status.getStatusCode().getStatusCode();
String subStatus = subStatusCode != null ? subStatusCode.getValue() : "";
return String.format(AUTHN_RESPONSE, samlResponse.getID(), samlResponse.getInResponseTo(), direction, samlResponse.getDestination(), issuerString, signatureStatus.valid(), status.getStatusCode().getValue(), subStatus, getStatusDetailValues(status));
}
Aggregations