use of com.forgerock.spring.security.multiauth.model.authentication.X509Authentication in project openbanking-aspsp by OpenBankingToolkit.
the class DynamicRegistrationApiControllerTest method failIfSsaIsNotSignedByTrustedParty_register.
@Test
public void failIfSsaIsNotSignedByTrustedParty_register() throws InvalidPsd2EidasCertificate, DynamicClientRegistrationException {
Collection<OBRIRole> authorities = new ArrayList<>(List.of(OBRIRole.ROLE_ANONYMOUS, OBRIRole.UNREGISTERED_TPP, OBRIRole.ROLE_EIDAS));
X509Authentication principal = testSpec.getPrincipal(authorities);
given(this.tppRegistrationService.validateSsaAgainstIssuingDirectoryJwksUri(anyString(), anyString())).willThrow(new DynamicClientRegistrationException("Test throw", UNAPPROVED_SOFTWARE_STATEMENT));
// when
DynamicClientRegistrationException exception = catchThrowableOfType(() -> dynamicRegistrationApiController.register(registrationRequestJwtSerialised, principal), DynamicClientRegistrationException.class);
assertThat(exception.getErrorType()).isEqualTo(UNAPPROVED_SOFTWARE_STATEMENT);
}
Aggregations