Uploaded image for project: 'MyFaces Tomahawk'
  1. MyFaces Tomahawk
  2. TOMAHAWK-1672

Wrong SessionKey name in session

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.1.15-SNAPSHOT
    • None
    • Captcha
    • None
    • JRE 1.6, JRE 1.7, MyFaces 2.1, Tomcat 7

    Description

      When using this component and try to validate the Captcha sessionkeyname against an input String (using the example approach), I found that the SessionKeyName value is null. But what is really happening is that the SessionKeyName varname is wrong. For example, insted of been "captchaSessionKeyName", when I list my session vars, it shows "captchaSessionKeyName_mySessionKeyName" (name appended twice or more).

      A work around for this while get patched, in order to get the session key name could be:

      public final static String SESSION_KEY_NAME = "mySessionKeyName";

      HttpSession httpsession = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(true);
      Enumeration<String> keys = httpsession.getAttributeNames();

      String captchaValue = null;
      while (keys.hasMoreElements())
      {
      String key = (String)keys.nextElement();
      if(key.contains(SESSION_KEY_NAME))
      captchaValue = (String) httpsession.getAttribute(key);
      }

      if (captchaValue.equalsIgnoreCase(value)) {
      //... your validations here...
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            eduardogt Eduardo Garcia
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: