use of uk.gov.ida.hub.samlengine.domain.SamlRequestDto in project verify-hub by alphagov.
the class IdpAuthnRequestGeneratorServiceTest method get_sendAuthnRequest_shouldReturnDtoWithSamlRequestAndPostLocation.
@Test
public void get_sendAuthnRequest_shouldReturnDtoWithSamlRequestAndPostLocation() {
String idpEntityId = UUID.randomUUID().toString();
IdaAuthnRequestFromHubDto dto = new IdaAuthnRequestFromHubDto("1", null, Optional.of(false), null, idpEntityId, false);
String samlRequest = "samlRequest";
URI ssoUri = UriBuilder.fromPath(UUID.randomUUID().toString()).build();
when(idaAuthnRequestFromHubStringTransformer.apply(Matchers.<IdaAuthnRequestFromHub>any())).thenReturn(samlRequest);
when(idpSingleSignOnServiceHelper.getSingleSignOn(idpEntityId)).thenReturn(ssoUri);
when(idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(dto, ssoUri, HUB_ENTITY_ID)).thenReturn(null);
final SamlRequestDto output = idpAuthnRequestGeneratorService.generateSaml(dto);
assertThat(output.getSamlRequest()).isEqualTo(samlRequest);
assertThat(output.getSsoUri()).isEqualTo(ssoUri);
}
use of uk.gov.ida.hub.samlengine.domain.SamlRequestDto in project verify-hub by alphagov.
the class CountryAuthnRequestGeneratorService method generateSaml.
public SamlRequestDto generateSaml(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto) {
URI ssoUri = idaAuthnRequestFromHubDto.getoverriddenSsoUrl() != null ? idaAuthnRequestFromHubDto.getoverriddenSsoUrl() : countrySingleSignOnServiceHelper.getSingleSignOn(idaAuthnRequestFromHubDto.getIdpEntityId());
EidasAuthnRequestFromHub eidasAuthnRequestFromHub = eidasAuthnRequestTranslator.getEidasAuthnRequestFromHub(idaAuthnRequestFromHubDto, ssoUri, hubEidasEntityId);
String request = eidasRequestStringTransformer.apply(eidasAuthnRequestFromHub);
return new SamlRequestDto(request, ssoUri);
}
use of uk.gov.ida.hub.samlengine.domain.SamlRequestDto in project verify-hub by alphagov.
the class IdpAuthnRequestGeneratorService method generateSaml.
public SamlRequestDto generateSaml(IdaAuthnRequestFromHubDto idaAuthnRequestFromHubDto) {
URI ssoUri = idpSingleSignOnServiceHelper.getSingleSignOn(idaAuthnRequestFromHubDto.getIdpEntityId());
IdaAuthnRequestFromHub idaAuthnRequestFromHub = idaAuthnRequestTranslator.getIdaAuthnRequestFromHub(idaAuthnRequestFromHubDto, ssoUri, hubEntityId);
String request = idaRequestStringTransformer.apply(idaAuthnRequestFromHub);
return new SamlRequestDto(request, ssoUri);
}
use of uk.gov.ida.hub.samlengine.domain.SamlRequestDto in project verify-hub by alphagov.
the class CountryAuthnRequestGeneratorServiceTest method generateSamlRequest.
@Test
public void generateSamlRequest() {
// Given
String theCountryEntityId = "theCountryEntityId";
IdaAuthnRequestFromHubDto dto = new IdaAuthnRequestFromHubDto("1", null, Optional.of(false), null, theCountryEntityId, false);
URI ssoUri = UriBuilder.fromPath("/the-sso-uri").build();
String samlRequest = "samlRequest";
when(eidasAuthnRequestFromHubStringTransformer.apply(any())).thenReturn(samlRequest);
when(countrySingleSignOnServiceHelper.getSingleSignOn(theCountryEntityId)).thenReturn(ssoUri);
when(eidasAuthnRequestTranslator.getEidasAuthnRequestFromHub(dto, ssoUri, HUB_ENTITY_ID)).thenReturn(null);
// When
final SamlRequestDto output = service.generateSaml(dto);
// Then
assertThat(output.getSamlRequest()).isEqualTo(samlRequest);
assertThat(output.getSsoUri()).isEqualTo(ssoUri);
verify(countrySingleSignOnServiceHelper).getSingleSignOn(theCountryEntityId);
verify(eidasAuthnRequestFromHubStringTransformer).apply(any(EidasAuthnRequestFromHub.class));
verifyNoMoreInteractions(countrySingleSignOnServiceHelper, eidasAuthnRequestFromHubStringTransformer);
}
use of uk.gov.ida.hub.samlengine.domain.SamlRequestDto in project verify-hub by alphagov.
the class CountryAuthnRequestGeneratorServiceTest method generateSamlRequestWithOverriddenSsoUri.
@Test
public void generateSamlRequestWithOverriddenSsoUri() {
// Given
String theCountryEntityId = "theCountryEntityId";
URI overriddenSsoURI = URI.create("http://overridden.foo.bar");
IdaAuthnRequestFromHubDto dto = new IdaAuthnRequestFromHubDto("1", null, Optional.of(false), null, theCountryEntityId, false, overriddenSsoURI);
URI ssoUri = UriBuilder.fromPath("/the-sso-uri").build();
String samlRequest = "samlRequest";
when(eidasAuthnRequestFromHubStringTransformer.apply(any())).thenReturn(samlRequest);
when(eidasAuthnRequestTranslator.getEidasAuthnRequestFromHub(dto, ssoUri, HUB_ENTITY_ID)).thenReturn(null);
// When
final SamlRequestDto output = service.generateSaml(dto);
// Then
assertThat(output.getSamlRequest()).isEqualTo(samlRequest);
assertThat(output.getSsoUri()).isEqualTo(overriddenSsoURI);
verifyNoMoreInteractions(countrySingleSignOnServiceHelper);
}
Aggregations