Search in sources :

Example 6 with ApiClientIdentity

use of com.forgerock.openbanking.common.services.onboarding.apiclient.ApiClientIdentity in project openbanking-aspsp by OpenBankingToolkit.

the class ManualRegistrationApiController method getOrganizationIdentifier.

@Override
public ResponseEntity<String> getOrganizationIdentifier(Principal principal) throws OAuth2InvalidClientException {
    try {
        ApiClientIdentity apiClientIdentity = identityFactory.getApiClientIdentity(principal);
        String organizationIdentifier = apiClientIdentity.getAuthorisationNumber().orElseThrow(() -> new OAuth2InvalidClientException("Could not get OrganizationIdentifier from  " + "certificate"));
        return ResponseEntity.status(HttpStatus.OK).body(organizationIdentifier);
    } catch (ApiClientException e) {
        log.info("getOrganizationIdentifier() caught ApiClientException; ", e);
        throw new OAuth2InvalidClientException("Failed to obtain OrganizationIdentifier from certificate");
    }
}
Also used : ApiClientException(com.forgerock.openbanking.common.services.onboarding.apiclient.ApiClientException) OAuth2InvalidClientException(com.forgerock.openbanking.common.error.exception.oauth2.OAuth2InvalidClientException) ApiClientIdentity(com.forgerock.openbanking.common.services.onboarding.apiclient.ApiClientIdentity)

Aggregations

ApiClientIdentity (com.forgerock.openbanking.common.services.onboarding.apiclient.ApiClientIdentity)6 OAuth2InvalidClientException (com.forgerock.openbanking.common.error.exception.oauth2.OAuth2InvalidClientException)4 ApiClientException (com.forgerock.openbanking.common.services.onboarding.apiclient.ApiClientException)4 RegistrationRequest (com.forgerock.openbanking.common.services.onboarding.registrationrequest.RegistrationRequest)4 Tpp (com.forgerock.openbanking.model.Tpp)4 OIDCRegistrationResponse (com.forgerock.openbanking.model.oidc.OIDCRegistrationResponse)2 Test (org.junit.Test)2 DynamicClientRegistrationException (com.forgerock.openbanking.common.error.exception.dynamicclientregistration.DynamicClientRegistrationException)1 ManualRegistrationApplication (com.forgerock.openbanking.common.model.onboarding.ManualRegistrationApplication)1 ManualRegistrationRequest (com.forgerock.openbanking.common.model.onboarding.ManualRegistrationRequest)1 OBRIRole (com.forgerock.openbanking.model.OBRIRole)1 X509Authentication (com.forgerock.spring.security.multiauth.model.authentication.X509Authentication)1