public void doIclubLogout() {

    String theme = "";
    String webTheme = "";
    if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.theme")) != null) {
      theme =
          IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.theme")).toString();
    }
    if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme")) != null) {
      webTheme =
          IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme"))
              .toString();
    }
    IclubWebHelper.invalidateSession();
    IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.theme"), theme);
    IclubWebHelper.addObjectIntoSession(BUNDLE.getString("logged.in.user.webTheme"), webTheme);
    FacesContext context = FacesContext.getCurrentInstance();
    NavigationHandler navigationHandler = context.getApplication().getNavigationHandler();

    navigationHandler.handleNavigation(
        context, null, "/templates/login" + theme + ".xhtml?faces-redirect=true");

    String url = "https://testclientapi.fraudcheck.co.za/api/authenticate/test";
    String currentDate = System.currentTimeMillis() + "";

    String fcHash = DigestUtils.md5Hex(FRAUD_CHECK_USERID + FRAUD_CHECK_PWD + currentDate);

    HttpClient client = getHttpClient();

    try {
      HttpPost post = new HttpPost(url);
      post.setHeader("Content-Type", "application/json");
      post.setHeader("FcAccId", FRAUD_CHECK_USERID);
      post.setHeader("FcHash", fcHash);
      post.setHeader("FcDate", currentDate);

      List<NameValuePair> arguments = new ArrayList<>(3);
      arguments.add(new BasicNameValuePair("data", "test"));
      post.setEntity(new UrlEncodedFormEntity(arguments));
      HttpResponse response1 = client.execute(post);
      EntityUtils.toString(response1.getEntity());
    } catch (Exception e) {
      LOGGER.error(e, e);
    }
  }
  public IclubPersonBean getBean() {
    if (bean == null) {
      bean = new IclubPersonBean();
    }
    if (!loadBean) {
      if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.id")) != null) {
        WebClient client =
            IclubWebHelper.createCustomClient(BASE_URL + "get/" + getSessionUserId());

        IclubPersonModel model =
            (IclubPersonModel)
                (client.accept(MediaType.APPLICATION_JSON).get(IclubPersonModel.class));
        client.close();
        bean = IclubPersonTrans.fromWStoUI(model);

        if (IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.login.id")) != null) {
          client =
              IclubWebHelper.createCustomClient(
                  LOG_BASE_URL
                      + "get/"
                      + IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.login.id"))
                          .toString());
        } else {
          client = IclubWebHelper.createCustomClient(LOG_BASE_URL + "person/" + bean.getPFName());
        }

        IclubLoginModel loginModel =
            (IclubLoginModel)
                (client.accept(MediaType.APPLICATION_JSON).get(IclubLoginModel.class));
        if (loginModel != null && loginModel.getLId() != null) {
          updateLogin = true;
          loginBean = IclubLoginTrans.fromWStoUI(loginModel);
        } else {
          updateLogin = false;
          loginBean = new IclubLoginBean();
        }
      }
    }

    return bean;
  }
  public String getState(String from) {
    String state = "{from:" + from + "}";
    try {
      if (IclubWebHelper.getObjectIntoSession("newInvite") != null) {
        state = "{from:" + from + ",redirect:newInvite}";
      }

      state = Base64.encodeBase64URLSafeString(state.getBytes());
    } catch (Exception e) {
      e.printStackTrace();
    }

    return state;
  }
 public String getSessionUserId() {
   Object sessUsrId = IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.id"));
   if (sessUsrId == null) sessionUserId = "1";
   else sessionUserId = sessUsrId.toString();
   return sessionUserId;
 }
 public String getUserName() {
   userName =
       IclubWebHelper.getObjectIntoSession(BUNDLE.getString("logged.in.user.scname")).toString();
   return userName;
 }