Search in sources :

Example 1 with AssertionDecrypter

use of uk.gov.ida.integrationtest.hub.samlengine.support.AssertionDecrypter in project verify-hub by alphagov.

the class CountryAuthnResponseTranslatorResourceTest method assertThatDecryptedAssertionsAreTheSame.

private void assertThatDecryptedAssertionsAreTheSame(InboundResponseFromCountry response, org.opensaml.saml.saml2.core.Response originalResponse) {
    AssertionDecrypter hubDecrypter = new AssertionDecrypter(TestCertificateStrings.HUB_TEST_PRIVATE_ENCRYPTION_KEY, TestCertificateStrings.HUB_TEST_PUBLIC_ENCRYPTION_CERT);
    List<Assertion> originalAssertions = hubDecrypter.decryptAssertions(originalResponse);
    AssertionDecrypter rpDecrypter = new AssertionDecrypter(TestCertificateStrings.TEST_RP_MS_PRIVATE_ENCRYPTION_KEY, TestCertificateStrings.TEST_RP_PUBLIC_ENCRYPTION_CERT);
    Assertion returnedAssertion = rpDecrypter.decryptAssertion(response.getEncryptedIdentityAssertionBlob().get());
    assertThat(originalAssertions).hasSize(1);
    Assertion originalAssertion = originalAssertions.get(0);
    assertEquals(returnedAssertion, originalAssertion);
}
Also used : AssertionDecrypter(uk.gov.ida.integrationtest.hub.samlengine.support.AssertionDecrypter) Assertion(org.opensaml.saml.saml2.core.Assertion)

Aggregations

Assertion (org.opensaml.saml.saml2.core.Assertion)1 AssertionDecrypter (uk.gov.ida.integrationtest.hub.samlengine.support.AssertionDecrypter)1