use of com.forgerock.openbanking.model.OBRIRole 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);
}
use of com.forgerock.openbanking.model.OBRIRole in project openbanking-aspsp by OpenBankingToolkit.
the class ApiClientIdentityFactoryTest method returnsApiClientFRTransport_getApiClientIdentity.
@Test
public void returnsApiClientFRTransport_getApiClientIdentity() throws CertificateException, IOException, ApiClientException, InvalidPsd2EidasCertificate, OAuth2InvalidClientException {
// given
X509Certificate[] certificatesChain = TestHelperFunctions.getCertChainFromFile("src/test/resources/certificates/fr-transport.pem");
Psd2CertInfo certInfo = new Psd2CertInfo(certificatesChain);
String tppName = "TestTppName";
Collection<OBRIRole> authorities = new ArrayList<>();
authorities.add(OBRIRole.UNREGISTERED_TPP);
PSD2Authentication authentication = new PSD2Authentication(tppName, authorities, certificatesChain, certInfo);
ApiClientIdentityFactory identityFactory = new ApiClientIdentityFactory();
// when
ApiClientIdentity identity = identityFactory.getApiClientIdentity(authentication);
// then
assertThat(identity).isInstanceOf(ApiClientIdentityFRTransport.class);
}
use of com.forgerock.openbanking.model.OBRIRole in project openbanking-aspsp by OpenBankingToolkit.
the class ApiClientIdentityFactoryTest method returnsApiClientOBWac_getApiClientIdentity.
@Test
public void returnsApiClientOBWac_getApiClientIdentity() throws CertificateException, IOException, ApiClientException, InvalidPsd2EidasCertificate, OAuth2InvalidClientException {
// given
X509Certificate[] certificatesChain = TestHelperFunctions.getCertChainFromFile("src/test/resources/certificates/OBWac.pem");
Psd2CertInfo certInfo = new Psd2CertInfo(certificatesChain);
String tppName = "TestTppName";
Collection<OBRIRole> authorities = new ArrayList<>();
authorities.add(OBRIRole.UNREGISTERED_TPP);
PSD2Authentication authentication = new PSD2Authentication(tppName, authorities, certificatesChain, certInfo);
ApiClientIdentityFactory identityFactory = new ApiClientIdentityFactory();
// when
ApiClientIdentity identity = identityFactory.getApiClientIdentity(authentication);
// then
assertThat(identity).isInstanceOf(ApiClientIdentityOBWac.class);
}
Aggregations