@Test void revokeConsent_error() throws NoSuchFieldException { when(responseUtils.consentCookie(any())).thenReturn(COOKIE); when(redirectConsentService.identifyConsent(anyString(), anyString(), anyBoolean(), anyString(), any())).thenThrow(new ConsentAuthorizeException(ResponseEntity.badRequest().build())); FieldSetter.setField(controller, controller.getClass().getDeclaredField("middlewareAuth"), new ObaMiddlewareAuthentication(null, new BearerTokenTO(TOKEN, null, 999, null, getAccessTokenTO()))); ResponseEntity<ConsentAuthorizeResponse> result = controller.revokeConsent(ENCRYPTED_ID, AUTH_ID, COOKIE); assertEquals(ResponseEntity.badRequest().build(), result); }
@Override public ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString) { ConsentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(cookieString); workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); } catch (ConsentAuthorizeException e) { return ResponseEntity.badRequest().build(); } String psuId = AuthUtils.psuId(middlewareAuth); if (failAuthorisation(workflow.consentId(), psuId, authorisationId)) { return ResponseEntity.ok(buildResponseForSuccessfulConsentRevoke()); } return ResponseEntity.badRequest().build(); }
AISController implements AISApi { @Override public ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString) { ConsentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(cookieString); workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); } catch (ConsentAuthorizeException e) { return ResponseEntity.badRequest().build(); } String psuId = AuthUtils.psuId(middlewareAuth); if (failAuthorisation(workflow.consentId(), psuId, authorisationId)) { return ResponseEntity.ok(buildResponseForSuccessfulConsentRevoke()); } return ResponseEntity.badRequest().build(); } }
AISController implements AISApi { @Override public ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString) { ConsentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(cookieString); workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); } catch (ConsentAuthorizeException e) { return ResponseEntity.badRequest().build(); } String psuId = AuthUtils.psuId(middlewareAuth); if (failAuthorisation(workflow.consentId(), psuId, authorisationId)) { return ResponseEntity.ok(buildResponseForSuccessfulConsentRevoke()); } return ResponseEntity.badRequest().build(); }  }
AISController implements AISApi { @Override public ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString) { ConsentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(cookieString); workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); } catch (ConsentAuthorizeException e) { return ResponseEntity.badRequest().build(); } String psuId = AuthUtils.psuId(middlewareAuth); if (failAuthorisation(workflow.consentId(), psuId, authorisationId)) { return ResponseEntity.ok(buildResponseForSuccessfulConsentRevoke()); } return ResponseEntity.badRequest().build(); }  @Override @ApiOperation(value = "Entry point for authenticating ais consent requests.") ResponseEntity<AuthorizeResponse> aisAuth(String redirectId, String encryptedConsentId, String token); @Override ResponseEntity<ConsentAuthorizeResponse> login(String encryptedConsentId, String authorisationId, String login, String pin, String consentCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> startConsentAuth(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, AisConsentTO aisConsent); @Override ResponseEntity<ConsentAuthorizeResponse> authrizedConsent(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, String authCode); @Override ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString); @Override ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> aisDone(String encryptedConsentId, String authorisationId, String cookie, boolean isOauth2Integrated, String authConfirmationCode); @Override ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString); }
AISController implements AISApi { @Override public ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString) { ConsentWorkflow workflow; try { String consentCookie = responseUtils.consentCookie(cookieString); workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); authInterceptor.setAccessToken(middlewareAuth.getBearerToken().getAccess_token()); } catch (ConsentAuthorizeException e) { return ResponseEntity.badRequest().build(); } String psuId = AuthUtils.psuId(middlewareAuth); if (failAuthorisation(workflow.consentId(), psuId, authorisationId)) { return ResponseEntity.ok(buildResponseForSuccessfulConsentRevoke()); } return ResponseEntity.badRequest().build(); }  @Override @ApiOperation(value = "Entry point for authenticating ais consent requests.") ResponseEntity<AuthorizeResponse> aisAuth(String redirectId, String encryptedConsentId, String token); @Override ResponseEntity<ConsentAuthorizeResponse> login(String encryptedConsentId, String authorisationId, String login, String pin, String consentCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> startConsentAuth(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, AisConsentTO aisConsent); @Override ResponseEntity<ConsentAuthorizeResponse> authrizedConsent(String encryptedConsentId, String authorisationId, String consentAndAccessTokenCookieString, String authCode); @Override ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString); @Override ResponseEntity<List<AccountDetailsTO>> getListOfAccounts(String accessTokenCookieString); @Override ResponseEntity<ConsentAuthorizeResponse> aisDone(String encryptedConsentId, String authorisationId, String cookie, boolean isOauth2Integrated, String authConfirmationCode); @Override ResponseEntity<ConsentAuthorizeResponse> revokeConsent(@NotNull String encryptedConsentId, @NotNull String authorisationId, String cookieString);  }