private <A extends AbstractAuthenticationAction<R>, R extends AbstractAuthenticationResult>
      void constructAndSendResponse(
          UserId userId,
          String clearTextPassword,
          ChapSession chapSession,
          AuthenticationActionFactory<A, R> actionFactory,
          final DispatchServiceCallback<AuthenticationResponse> callback) {
    SaltedPasswordDigest saltedPasswordDigest =
        passwordDigestAlgorithm.getDigestOfSaltedPassword(clearTextPassword, chapSession.getSalt());

    ChapResponse response =
        responseDigestAlgorithm.getChapResponseDigest(
            chapSession.getChallengeMessage(), saltedPasswordDigest);

    sendResponse(userId, chapSession, response, actionFactory, callback);
  }