Search in sources :

Example 11 with X509Authentication

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);
}
Also used : OBRIRole(com.forgerock.openbanking.model.OBRIRole) DynamicClientRegistrationException(com.forgerock.openbanking.common.error.exception.dynamicclientregistration.DynamicClientRegistrationException) X509Authentication(com.forgerock.spring.security.multiauth.model.authentication.X509Authentication) Test(org.junit.Test)

Aggregations

X509Authentication (com.forgerock.spring.security.multiauth.model.authentication.X509Authentication)11 Test (org.junit.Test)10 OBRIRole (com.forgerock.openbanking.model.OBRIRole)5 Tpp (com.forgerock.openbanking.model.Tpp)5 RegistrationRequest (com.forgerock.openbanking.common.services.onboarding.registrationrequest.RegistrationRequest)4 FRAccountRequest (com.forgerock.openbanking.common.model.openbanking.persistence.account.FRAccountRequest)3 ApiClientIdentity (com.forgerock.openbanking.common.services.onboarding.apiclient.ApiClientIdentity)3 OIDCRegistrationResponse (com.forgerock.openbanking.model.oidc.OIDCRegistrationResponse)3 Authentication (org.springframework.security.core.Authentication)3 RoleOfPsp (com.forgerock.cert.psd2.RoleOfPsp)2 DynamicClientRegistrationException (com.forgerock.openbanking.common.error.exception.dynamicclientregistration.DynamicClientRegistrationException)2 OBErrorException (com.forgerock.openbanking.exceptions.OBErrorException)2 PSD2GrantType (com.forgerock.spring.security.multiauth.model.granttypes.PSD2GrantType)2 Psd2CertInfo (com.forgerock.cert.Psd2CertInfo)1 OAuth2InvalidClientException (com.forgerock.openbanking.common.error.exception.oauth2.OAuth2InvalidClientException)1 PSD2Authentication (com.forgerock.spring.security.multiauth.model.authentication.PSD2Authentication)1