use of org.opensaml.saml2.core.AuthnRequest in project verify-hub by alphagov.
the class AuthnRequestFromRelyingPartyUnmarshallerTest method fromSamlMessage_shouldNotComplainWhenExceptionDuringDecryption.
@Test
public void fromSamlMessage_shouldNotComplainWhenExceptionDuringDecryption() throws Exception {
AuthnRequest authnRequest = new AuthnRequestBuilder().buildObject();
authnRequest.setIssuer(new IssuerBuilder().buildObject());
authnRequest.setDestination("http://example.com");
authnRequest.setExtensions(createApplicationVersionExtensions(null));
AuthnRequestFromRelyingParty authnRequestFromRelyingParty = unmarshaller.fromSamlMessage(authnRequest);
assertThat(authnRequestFromRelyingParty.getVerifyServiceProviderVersion()).isEqualTo(Optional.empty());
}
use of org.opensaml.saml2.core.AuthnRequest in project verify-hub by alphagov.
the class RpAuthnRequestTranslatorService method translate.
public TranslatedAuthnRequestDto translate(SamlRequestWithAuthnRequestInformationDto samlRequestWithAuthnRequestInformationDto) {
AuthnRequest authnRequest = stringToAuthnRequestTransformer.apply(samlRequestWithAuthnRequestInformationDto.getSamlMessage());
MdcHelper.addContextToMdc(authnRequest.getID(), authnRequest.getIssuer().getValue());
AuthnRequestFromRelyingParty authnRequestFromRelyingParty = authnRequestToIdaRequestFromRelyingPartyTransformer.apply(authnRequest);
if (authnRequestFromRelyingParty.getVerifyServiceProviderVersion().isPresent()) {
logAndSendMetricForVspVersion(authnRequestFromRelyingParty);
}
UnknownMethodAlgorithmLogger.probeAuthnRequestForMethodAlgorithm(authnRequestFromRelyingParty);
return new TranslatedAuthnRequestDto(authnRequestFromRelyingParty.getId(), authnRequestFromRelyingParty.getIssuer(), authnRequestFromRelyingParty.getForceAuthentication(), authnRequestFromRelyingParty.getAssertionConsumerServiceUrl(), authnRequestFromRelyingParty.getAssertionConsumerServiceIndex());
}
use of org.opensaml.saml2.core.AuthnRequest in project verify-hub by alphagov.
the class ProtectiveMonitoringLogFormatterTest method shouldFormatAuthnRequestWithoutIssuer.
@Test
public void shouldFormatAuthnRequestWithoutIssuer() {
AuthnRequest authnRequest = anAuthnRequest().withId("test-id").withDestination("veganistan").withIssuer(null).build();
String logString = new ProtectiveMonitoringLogFormatter().formatAuthnRequest(authnRequest, Direction.INBOUND, SignatureStatus.VALID_SIGNATURE);
assertThat(logString).contains("issuerId: ,");
}
use of org.opensaml.saml2.core.AuthnRequest in project verify-hub by alphagov.
the class ProtectiveMonitoringLogFormatterTest method shouldFormatAuthnRequest.
@Test
public void shouldFormatAuthnRequest() {
AuthnRequest authnRequest = anAuthnRequest().withId("test-id").withDestination("veganistan").build();
String logString = new ProtectiveMonitoringLogFormatter().formatAuthnRequest(authnRequest, Direction.INBOUND, SignatureStatus.VALID_SIGNATURE);
String expectedLogMessage = "Protective Monitoring – Authn Request Event – {" + "requestId: test-id, " + "direction: INBOUND, " + "destination: veganistan, " + "issuerId: a-test-entity, " + "validSignature: true}";
assertThat(logString).isEqualTo(expectedLogMessage);
}
use of org.opensaml.saml2.core.AuthnRequest in project verify-hub by alphagov.
the class IdaAuthnRequestFromHubToAuthnRequestTransformerTest method shouldUseTheOriginalExpiryTimestampToSetTheNotOnOrAfter.
@Test
public void shouldUseTheOriginalExpiryTimestampToSetTheNotOnOrAfter() {
DateTime sessionExpiry = DateTime.now().plusHours(2);
IdaAuthnRequestFromHub originalRequestFromHub = anIdaAuthnRequest().withSessionExpiryTimestamp(sessionExpiry).buildFromHub();
AuthnRequest transformedRequest = transformer.apply(originalRequestFromHub);
assertThat(transformedRequest.getConditions().getNotOnOrAfter()).isEqualTo(sessionExpiry);
}
Aggregations