@Override
    public AppResponse process(Flow flow, ActivationUsernamePasswordRequest body) throws SharedServiceClientException {
        digidClient.remoteLog("1088", Map.of(lowerUnderscore(HIDDEN), true));
        var result = digidClient.authenticate(body.getUsername(), body.getPassword());

        if (result.get(lowerUnderscore(STATUS)).equals("NOK") && result.get(ERROR) != null ) {
            final var error = (String) result.get(ERROR);

            if (ERROR_DECEASED.equals(error)) {
                digidClient.remoteLog("1482", Map.of(lowerUnderscore(ACCOUNT_ID), result.get(lowerUnderscore(ACCOUNT_ID)), "hidden", true));
            } else if (ERROR_NO_BSN.equals(error)) {
                digidClient.remoteLog("1074", Map.of(lowerUnderscore(ACCOUNT_ID), result.get(lowerUnderscore(ACCOUNT_ID))));
            } else if (ERROR_ACCOUNT_BLOCKED.equals(error)) {
                return new PasswordConfirmedResponse((String) result.get(ERROR), result);
            }
            return new NokResponse((String) result.get(ERROR));
        }

        return Optional.ofNullable(validateAmountOfApps(Long.valueOf((Integer) result.get(lowerUnderscore(ACCOUNT_ID))), body))
            .orElseGet(() -> getActivationUsernamePasswordResponse(body, result));

    }
@Test
    void nokResponseToManyAmountOfApps() throws SharedServiceClientException {
        when(sharedServiceClientMock.getSSConfigInt("Maximum_aantal_DigiD_apps_eindgebruiker")).thenReturn(5);
        AppAuthenticator oldApp = new AppAuthenticator();
        oldApp.setDeviceName("test_device");
        oldApp.setLastSignInAt(ZonedDateTime.now());
        when(digidClientMock.authenticate(anyString(), anyString())).thenReturn(responseDigidClient);
        when(appAuthenticatorServiceMock.countByAccountIdAndInstanceIdNot(anyLong(), anyString())).thenReturn(6);
        when(appAuthenticatorServiceMock.findLeastRecentApp(anyLong())).thenReturn(oldApp);

        AppResponse result = passwordConfirmed.process(flow, request);

        assertTrue(result instanceof NokResponse);
        assertNotNull(result);

        NokResponse response = (NokResponse) result;
        assertNotNull(response);
        assertEquals("NOK", response.getStatus());
        assertEquals("too_many_active", response.getError());
    }