/**
   * To get the challenge question for the user.
   *
   * @param userName
   * @param confirmation
   * @param questionId - Question id returned from the getUserChanllegneQuestionIds method.
   * @return Populated question bean with the question details and the key.
   * @throws IdentityMgtServiceException
   */
  public UserChallengesDTO getUserChallengeQuestion(
      String userName, String confirmation, String questionId) throws IdentityMgtServiceException {

    UserDTO userDTO = null;
    UserChallengesDTO userChallengesDTO = new UserChallengesDTO();

    if (log.isDebugEnabled()) {
      log.debug("User challenge question request received with username :"******"Error validating user : "******"Invalid confirmation code for user : "******"User challenge question retrieved successfully");
        }
      } else {
        if (log.isDebugEnabled()) {
          log.debug("Verification failed for user. Error : " + bean.getError());
        }
        userChallengesDTO.setError(
            VerificationBean.ERROR_CODE_INVALID_USER + " " + bean.getError());
      }
    } finally {
      if (IdentityMgtConfig.getInstance().isSaasEnabled()) {
        PrivilegedCarbonContext.endTenantFlow();
      }
    }

    return userChallengesDTO;
  }