use of uk.gov.ida.common.SessionId in project verify-hub by alphagov.
the class PolicyStubRule method receiveAuthnResponseFromCountry.
public void receiveAuthnResponseFromCountry(String sessionId, LevelOfAssurance loaAchieved) throws JsonProcessingException {
String locationUri = getAuthnResponseFromCountryLocation(sessionId);
ResponseActionDto responseActionDto = ResponseActionDto.success(new SessionId(sessionId), false, loaAchieved);
register(locationUri, Status.OK.getStatusCode(), responseActionDto);
}
use of uk.gov.ida.common.SessionId in project verify-hub by alphagov.
the class PolicyStubRule method receiveAuthnResponseFromIdp.
public void receiveAuthnResponseFromIdp(String sessionId, LevelOfAssurance loaAchieved) throws JsonProcessingException {
String locationUri = getAuthnResponseFromIdpLocation(sessionId);
ResponseActionDto responseActionDto = ResponseActionDto.success(new SessionId(sessionId), false, loaAchieved);
register(locationUri, Status.OK.getStatusCode(), responseActionDto);
}
use of uk.gov.ida.common.SessionId in project verify-hub by alphagov.
the class CountryMetadataConsumerTest method shouldReturnErrorWhenValidatingEidasAuthnResponseContainingInvalidSignature.
@Test
public void shouldReturnErrorWhenValidatingEidasAuthnResponseContainingInvalidSignature() throws Exception {
// Given
SessionId sessionId = SessionId.createNewSessionId();
String response = authnResponseFactory.aSamlResponseFromIdp("a-request", countryMetadata.getCountryMetadataUri(), anotherIdpSigningCert, anotherIdpSigningKey, "", SIGNATURE_ALGORITHM, DIGEST_ALGORITHM);
// When
Response responseFromSamlProxy = postSAML(new SamlRequestDto(response, sessionId.getSessionId(), "127.0.0.1"));
// Then
assertThat(responseFromSamlProxy.getStatus()).isEqualTo(Response.Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
use of uk.gov.ida.common.SessionId in project verify-hub by alphagov.
the class CountryAuthnResponseTranslatorResourceTest method createAuthnResponseSignedByKeyPair.
private SamlAuthnResponseTranslatorDto createAuthnResponseSignedByKeyPair(String publicKey, String privateKey) throws Exception {
SessionId sessionId = SessionId.createNewSessionId();
String samlResponse = authnResponseFactory.aSamlResponseFromCountry("a-request", samlEngineAppRule.getCountryMetadataUri(), publicKey, privateKey, DESTINATION, SIGNATURE_ALGORITHM, DIGEST_ALGORITHM, EncryptionConstants.ALGO_ID_BLOCKCIPHER_AES256_GCM, EidasAuthnContext.EIDAS_LOA_SUBSTANTIAL, DESTINATION, samlEngineAppRule.getCountryMetadataUri());
return new SamlAuthnResponseTranslatorDto(samlResponse, sessionId, "127.0.0.1", matchingServiceEntityId);
}
use of uk.gov.ida.common.SessionId in project verify-hub by alphagov.
the class AttributeQueryRequestRunnableTest method run_shouldNotSendResponse_IfAttributeQueryHasTimedOut_AfterSendingMessage.
@Test
public void run_shouldNotSendResponse_IfAttributeQueryHasTimedOut_AfterSendingMessage() throws Exception {
final Element matchingServiceResponse = XmlUtils.convertToElement("<someResponse/>");
when(executeAttributeQueryRequest.execute(sessionId, attributeQueryContainerDto)).thenReturn(matchingServiceResponse);
doNothing().doThrow(new AttributeQueryTimeoutException()).when(timeoutEvaluator).hasAttributeQueryTimedOut(attributeQueryContainerDto);
attributeQueryRequestRunnable.run();
verify(executeAttributeQueryRequest).execute(sessionId, attributeQueryContainerDto);
verify(hubMatchingServiceResponseReceiverProxy, never()).notifyHubOfAResponseFromMatchingService(any(SessionId.class), any(String.class));
verify(eventSinkProxy, times(1)).logHubEvent(isA(EventSinkHubEvent.class));
verify(eventEmitter, times(1)).record(isA(EventSinkHubEvent.class));
}
Aggregations