use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class Cycle3MatchRequestSentStateControllerTest method shouldReturnWaitResponseWhenAskedAndInCycle3MatchRequestSentState.
@Test
public void shouldReturnWaitResponseWhenAskedAndInCycle3MatchRequestSentState() {
final String requestId = "requestId";
final SessionId sessionId = SessionId.createNewSessionId();
Cycle3MatchRequestSentState state = aCycle3MatchRequestSentState().withSessionId(sessionId).withRequestId(requestId).build();
Cycle3MatchRequestSentStateController controller = new Cycle3MatchRequestSentStateController(state, hubEventLogger, stateTransitionAction, policyConfiguration, null, null, transactionsConfigProxy, matchingServiceConfigProxy, assertionRestrictionFactory, attributeQueryService);
when(policyConfiguration.getMatchingServiceResponseWaitPeriod()).thenReturn(Duration.standardMinutes(5));
final ResponseProcessingDetails responseProcessingDetails = controller.getResponseProcessingDetails();
assertThat(responseProcessingDetails.getResponseProcessingStatus()).isEqualTo(ResponseProcessingStatus.WAIT);
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class EidasAwaitingCycle3DataStateControllerTest method handleCancellation.
@Test
public void handleCancellation() {
doNothing().when(hubEventLogger).logCycle3DataInputCancelled(state.getSessionId(), state.getRequestIssuerEntityId(), state.getSessionExpiryTimestamp(), state.getRequestId());
final Cycle3DataInputCancelledState expectedState = new Cycle3DataInputCancelledState(state.getRequestId(), state.getSessionExpiryTimestamp(), state.getRelayState(), state.getRequestIssuerEntityId(), state.getAssertionConsumerServiceUri(), new SessionId(state.getSessionId().getSessionId()), state.getTransactionSupportsEidas());
controller.handleCancellation();
verify(stateTransitionAction).transitionTo(expectedState);
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class AuthnRequestFromTransactionResourceIntegrationTest method getSignInProcessDto_shouldReturnSignInDetailsDto.
@Test
public void getSignInProcessDto_shouldReturnSignInDetailsDto() {
SessionId session = SessionId.createNewSessionId();
TestSessionResourceHelper.createSessionInIdpSelectedState(session, samlResponse.getIssuer(), idpEntityId, client, buildUriForTestSession(IDP_SELECTED_STATE, session));
Response response = getAuthRequestSignInProcess(session);
assertThat(response.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
AuthnRequestSignInDetailsDto entity = response.readEntity(AuthnRequestSignInDetailsDto.class);
assertThat(entity.getRequestIssuerId()).isEqualTo(samlResponse.getIssuer());
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class Cycle3DataResourceTest method should_ReturnSuccessWhenDataSubmitted.
@Test
public void should_ReturnSuccessWhenDataSubmitted() throws JsonProcessingException {
// Given
SessionId sessionId = SessionIdBuilder.aSessionId().build();
String rpEntityId = new Cycle3DTO(sessionId).getRequestIssuerId();
String msaEntityId = new Cycle3DTO(sessionId).getMatchingServiceEntityId();
Response sessionCreatedResponse = createSessionInAwaitingCycle3DataState(sessionId);
assertThat(sessionCreatedResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
final Cycle3UserInput cycle3UserInput = new Cycle3UserInput("test-value", "principal-ip-address-seen-by-hub");
samlEngineStub.setupStubForAttributeQueryRequest(AttributeQueryContainerDtoBuilder.anAttributeQueryContainerDto().build());
configStub.setUpStubForMatchingServiceRequest(rpEntityId, msaEntityId);
final MatchingProcessDto cycle3Attribute = new MatchingProcessDto(Optional.of("TUFTY_CLUB_CARD"));
configStub.setUpStubForEnteringAwaitingCycle3DataState(rpEntityId, cycle3Attribute);
samlSoapProxyProxyStub.setUpStubForSendHubMatchingServiceRequest(sessionId);
// When
postCycle3Data(sessionId, cycle3UserInput);
// Then
assertThat(getSessionStateName(sessionId)).isEqualTo(Cycle3MatchRequestSentState.class.getName());
}
use of uk.gov.ida.hub.policy.domain.SessionId in project verify-hub by alphagov.
the class Cycle3DataResourceTest method shouldUpdateSessionStateToCancelledCycle3InputStateWhenInputToCycle3IsCancelled.
@Test
public void shouldUpdateSessionStateToCancelledCycle3InputStateWhenInputToCycle3IsCancelled() throws JsonProcessingException {
// Given
SessionId sessionId = SessionIdBuilder.aSessionId().build();
Response sessionCreatedResponse = createSessionInAwaitingCycle3DataState(sessionId);
assertThat(sessionCreatedResponse.getStatus()).isEqualTo(Response.Status.OK.getStatusCode());
// When
cancelCycle3Data(sessionId);
// Then
assertThat(getSessionStateName(sessionId)).isEqualTo(Cycle3DataInputCancelledState.class.getName());
}
Aggregations