@Override
    public AppResponse process(Flow flow, RdaSessionRequest request) throws FlowNotDefinedException, IOException, NoSuchAlgorithmException, SharedServiceClientException {
        var authAppSession = appSessionService.getSession(request.getAuthSessionId());

        if (!isAppSessionAuthenticated(authAppSession) || !request.getUserAppId().equals(authAppSession.getUserAppId())){
            return new NokResponse();
        }

        AppAuthenticator appAuthenticator = appAuthenticatorService.findByUserAppId(request.getUserAppId());
        if (!isAppAuthenticatorActivated(appAuthenticator)) return new NokResponse();

        appSession = new AppSession();
        appSession.setAction("upgrade_app");
        appSession.setFlow(UpgradeLoginLevel.NAME);
        appSession.setRdaAction("app");
        appSession.setUserAppId(appAuthenticator.getUserAppId());
        appSession.setDeviceName(appAuthenticator.getDeviceName());
        appSession.setInstanceId(appAuthenticator.getInstanceId());
        appSession.setAccountId(appAuthenticator.getAccountId());

        digidClient.remoteLog("844", Map.of(lowerUnderscore(ACCOUNT_ID), appSession.getAccountId(), lowerUnderscore(APP_CODE), appAuthenticator.getAppCode() ,lowerUnderscore(DEVICE_NAME), appAuthenticator.getDeviceName(), lowerUnderscore(HIDDEN), true));

        return new RdaSessionResponse(appSession.getId(), appSession.getAction());
    }
@Test
    void processOk() throws FlowNotDefinedException, SharedServiceClientException, IOException, NoSuchAlgorithmException {
        //given
        AppAuthenticator appAuthenticator = new AppAuthenticator();
        appAuthenticator.setUserAppId("userAppId");
        appAuthenticator.setInstanceId("123456");
        appAuthenticator.setDeviceName("deviceName");
        appAuthenticator.setAccountId(1L);
        appAuthenticator.setActivatedAt(ZonedDateTime.now());

        AppSession session = new AppSession();
        session.setState(State.AUTHENTICATED.name());
        session.setUserAppId("userAppId");

        when(appAuthenticatorService.findByUserAppId(any())).thenReturn(appAuthenticator);
        when(appSessionService.getSession(any())).thenReturn(session);

        RdaSessionResponse appResponse = (RdaSessionResponse) initRda.process(mockedFlow, request);

        assertEquals("upgrade_app", appResponse.getAction());
    }