@Test void selectMethod() throws NoSuchFieldException { FieldSetter.setField(controller, controller.getClass().getDeclaredField("middlewareAuth"), new ObaMiddlewareAuthentication(null, new BearerTokenTO(TOKEN, null, 999, null, getAccessTokenTO()))); when(responseUtils.consentCookie(any())).thenReturn(COOKIE); when(redirectConsentService.identifyConsent(anyString(), anyString(), anyBoolean(), anyString(), any())).thenReturn(getConsentWorkflow(SCAMETHODSELECTED, ConsentStatus.RECEIVED)); ResponseEntity<ConsentAuthorizeResponse> result = controller.selectMethod(ENCRYPTED_ID, AUTH_ID, METHOD_ID, COOKIE); assertEquals(ResponseEntity.ok(getConsentAuthorizeResponse(true, true, false, SCAMETHODSELECTED)), result); }
@Override public ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString) { String psuId = AuthUtils.psuId(middlewareAuth); try { String consentCookie = responseUtils.consentCookie(consentAndAccessTokenCookieString); ConsentWorkflow workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); redirectConsentService.selectScaMethod(scaMethodId, workflow); redirectConsentService.updateScaStatusConsentStatusConsentData(psuId, workflow); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); return ResponseEntity.ok(workflow.getAuthResponse()); } catch (ConsentAuthorizeException e) { return e.getError(); } }
AISController implements AISApi { @Override public ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString) { String psuId = AuthUtils.psuId(middlewareAuth); try { String consentCookie = responseUtils.consentCookie(consentAndAccessTokenCookieString); ConsentWorkflow workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); redirectConsentService.selectScaMethod(scaMethodId, workflow); redirectConsentService.updateScaStatusConsentStatusConsentData(psuId, workflow); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); return ResponseEntity.ok(workflow.getAuthResponse()); } catch (ConsentAuthorizeException e) { return e.getError(); } } }
AISController implements AISApi { @Override public ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString) { String psuId = AuthUtils.psuId(middlewareAuth); try { String consentCookie = responseUtils.consentCookie(consentAndAccessTokenCookieString); ConsentWorkflow workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); redirectConsentService.selectScaMethod(scaMethodId, workflow); redirectConsentService.updateScaStatusConsentStatusConsentData(psuId, workflow); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); return ResponseEntity.ok(workflow.getAuthResponse()); } catch (ConsentAuthorizeException e) { return e.getError(); } }  }
AISController implements AISApi { @Override public ResponseEntity<ConsentAuthorizeResponse> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString) { String psuId = AuthUtils.psuId(middlewareAuth); try { String consentCookie = responseUtils.consentCookie(consentAndAccessTokenCookieString); ConsentWorkflow workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); redirectConsentService.selectScaMethod(scaMethodId, workflow); redirectConsentService.updateScaStatusConsentStatusConsentData(psuId, workflow); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); return ResponseEntity.ok(workflow.getAuthResponse()); } catch (ConsentAuthorizeException e) { return e.getError(); } }  @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> selectMethod(String encryptedConsentId, String authorisationId, String scaMethodId, String consentAndAccessTokenCookieString) { String psuId = AuthUtils.psuId(middlewareAuth); try { String consentCookie = responseUtils.consentCookie(consentAndAccessTokenCookieString); ConsentWorkflow workflow = redirectConsentService.identifyConsent(encryptedConsentId, authorisationId, true, consentCookie, middlewareAuth.getBearerToken()); redirectConsentService.selectScaMethod(scaMethodId, workflow); redirectConsentService.updateScaStatusConsentStatusConsentData(psuId, workflow); responseUtils.setCookies(response, workflow.getConsentReference(), workflow.bearerToken().getAccess_token(), workflow.bearerToken().getAccessTokenObject()); return ResponseEntity.ok(workflow.getAuthResponse()); } catch (ConsentAuthorizeException e) { return e.getError(); } }  @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);  }