use of uk.gov.ida.hub.policy.domain.IdpSelected in project verify-hub by alphagov.
the class SessionTimeoutIntegrationTests method selectIdpShouldReturnErrorWhenSessionHasTimedOut.
@Test
public void selectIdpShouldReturnErrorWhenSessionHasTimedOut() {
DateTimeFreezer.freezeTime(SOME_TIME);
SessionId sessionId = client.target(policy.uri(Urls.PolicyUrls.NEW_SESSION_RESOURCE)).request().post(Entity.entity(samlRequest, MediaType.APPLICATION_JSON_TYPE), SessionId.class);
DateTimeFreezer.freezeTime(SOME_TIME.plusMinutes(SOME_TIMEOUT + 1));
URI uri = UriBuilder.fromPath(Urls.PolicyUrls.AUTHN_REQUEST_SELECT_IDP_RESOURCE).buildFromEncoded(sessionId);
confirmError(policy.uri(uri.getPath()), new IdpSelected(STUB_IDP_ONE, "some-ip-address", REGISTERING, REQUESTED_LOA), SESSION_TIMEOUT);
}
use of uk.gov.ida.hub.policy.domain.IdpSelected in project verify-hub by alphagov.
the class AuthnRequestFromTransactionResourceIntegrationTest method idpSelected_shouldThrowIfSessionInWrongState.
@Test
public void idpSelected_shouldThrowIfSessionInWrongState() {
sessionId = SessionId.createNewSessionId();
TestSessionResourceHelper.createSessionInSuccessfulMatchState(sessionId, transactionEntityId, idpEntityId, client, buildUriForTestSession(SUCCESSFUL_MATCH_STATE, sessionId));
Response response = postIdpSelected(new IdpSelected("does-not-exist", principalIpAddress, REGISTERING, LEVEL_2));
assertThat(response.getStatus()).isEqualTo(Response.Status.BAD_REQUEST.getStatusCode());
ErrorStatusDto error = response.readEntity(ErrorStatusDto.class);
assertThat(error.getExceptionType()).isEqualTo(ExceptionType.INVALID_STATE);
}
use of uk.gov.ida.hub.policy.domain.IdpSelected in project verify-hub by alphagov.
the class MatchingServiceResourcesIntegrationTest method anIdpIsSelectedForRegistration.
private void anIdpIsSelectedForRegistration(SessionId sessionId, String idpEntityId) {
final URI policyUri = policy.uri(UriBuilder.fromPath(Urls.PolicyUrls.AUTHN_REQUEST_SELECT_IDP_RESOURCE).build(sessionId).getPath());
postResponse(policyUri, new IdpSelected(idpEntityId, "this-is-an-ip-address", REGISTERING, LEVEL_2));
}
use of uk.gov.ida.hub.policy.domain.IdpSelected in project verify-hub by alphagov.
the class SessionResourceAuthnResponseFromIdpIntegrationTests method anIdpIsSelectedForRegistration.
private void anIdpIsSelectedForRegistration(SessionId sessionId, String idpEntityId) {
final URI policyUri = policy.uri(UriBuilder.fromPath(Urls.PolicyUrls.AUTHN_REQUEST_SELECT_IDP_RESOURCE).build(sessionId).getPath());
client.target(policyUri).request().post(Entity.entity(new IdpSelected(idpEntityId, "this-is-an-ip-address", REGISTERING, REQUESTED_LOA), MediaType.APPLICATION_JSON_TYPE));
}
use of uk.gov.ida.hub.policy.domain.IdpSelected in project verify-hub by alphagov.
the class SessionResourceIntegrationTest method anIdpIsSelectedForRegistration.
private void anIdpIsSelectedForRegistration(SessionId sessionId, String idpEntityId) {
final URI policyUri = policy.uri(UriBuilder.fromPath(Urls.PolicyUrls.AUTHN_REQUEST_SELECT_IDP_RESOURCE).build(sessionId).getPath());
post(policyUri, new IdpSelected(idpEntityId, "this-is-an-ip-address", REGISTERING, REQUESTED_LOA));
}
Aggregations