ICEfaces
  1. ICEfaces
  2. ICE-3808

RuntimeException "Cannot determine if user in role" during file upload

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8DR#1
    • Fix Version/s: 1.8
    • Component/s: Framework
    • Labels:
      None
    • Environment:
      Tomcat or JBoss with JAAS authentication

      Description

      Steps to reproduce the RuntimeException :

      1. Create a JSF page holding a "ice:inputFile" component. This page must be protected by HTTP authentication (in web.xml). Only users with role "foo" may access it.

      <security-constraint>
              <web-resource-collection>
                  <web-resource-name>Admin Constraints</web-resource-name>
                  <url-pattern>/app/*</url-pattern>
                  <http-method>GET</http-method>
                  <http-method>POST</http-method>
              </web-resource-collection>
              
              <auth-constraint>
                  <role-name>foo</role-name>
              </auth-constraint>
          </security-constraint>
          
          <login-config>
              <auth-method>FORM</auth-method>
              <realm-name>viperats-admin</realm-name>
              
              <form-login-config>
                  <form-login-page>/login.jsp</form-login-page>
                  <form-error-page>/loginerr.jsp</form-error-page>
              </form-login-config>
          </login-config>

      <security-role>
              <role-name>foo</role-name>
          </security-role>

      2. Create a menu page with a "ice:menuItem" element. IMPORTANT: The menuitem must contain an "enabledOnUserRole='foo'" attribute.
          Without enabledOnUserRole or without authentication the issue does not appear.

      <ice:menuItem id="License"
                              enabledOnUserRole="foo"
                              renderedOnUserRole="foo"
                              value="License"
                              action="menuLicense" />

      3. Open the menu page, click on the menu link to get to the file upload page. Log in with a user which has role "foo". Perform a file upload and the Servlet container will
          log a stack trace like the one below to stderr. Progress bar will not be updated.

      This issue has been there since ICEfaces 1.7.0 and was confirmed to be still there also in 1.8DR1

      Caused by: java.lang.RuntimeException: Cannot determine if user in role. User information is not available.
      at com.icesoft.faces.context.BridgeExternalContext$4.isUserInRole(BridgeExternalContext.java:138)
      at com.icesoft.faces.webapp.http.servlet.ServletEnvironmentRequest.isUserInRole(ServletEnvironmentRequest.java:207)
      at com.icesoft.faces.webapp.http.servlet.ServletExternalContext.isUserInRole(ServletExternalContext.java:243)
      at com.icesoft.faces.component.ext.taglib.Util.isRenderedOnUserRole(Util.java:111)
      at com.icesoft.faces.component.menubar.MenuItem.isRendered(MenuItem.java:402)
      at com.icesoft.faces.component.menubar.MenuItemRenderer.renderSubMenuItem(MenuItemRenderer.java:549)
      at com.icesoft.faces.component.menubar.MenuItemRenderer.renderChildrenRecursive(MenuItemRenderer.java:448)
      at com.icesoft.faces.component.menubar.MenuItemRenderer.encodeBegin(MenuItemRenderer.java:230)
      at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
      at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:350)
      at com.icesoft.faces.component.menubar.MenuBarRenderer.encodeChildren(MenuBarRenderer.java:117)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      at com.icesoft.faces.renderkit.dom_html_basic.DomBasicRenderer.encodeParentAndChildren(DomBasicRenderer.java:352)
      at com.icesoft.faces.renderkit.dom_html_basic.GridRenderer.encodeChildren(GridRenderer.java:203)
      at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:571)
      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
      at com.icesoft.faces.application.D2DViewHandler.renderResponse(D2DViewHandler.java:575)
      at com.icesoft.faces.facelets.D2DFaceletViewHandler.renderResponse(D2DFaceletViewHandler.java:282)

        Issue Links

          Activity

          Hide
          Mark Collette added a comment -

          On the main page that comes up, after you log in, there's a Commence button that will do 10 server pushes, 2 seconds apart, updating the same progress bar that the file upload uses. This will allow us to test any differences between regular server pushes and file upload server pushes.

          What I've found is that upon doing an action that should result in a server push, the browser receives a receive-updated-views message that references the current view. But, either the browser javascript does not act on this, or it does, but the server quietly discards the request for any updates. I think a phase listener should be installed to confirm that JSF lifecycles are happening to bring about the receive-updated-views. Then, debug should be added to the servlet to see if the browser is in fact contacting it for the updates. Maybe port listening software should be used, since I'm not sure the Firebug can differentiate between no server connection having been made, and one that has been made, but hasn't received a response.

          Server push, one of these every 2 seconds

          http://localhost:8080/ice-bug/block/receive-updated-views
          <updated-views>d9dGRkj2QEM5ZGqPWqwe7A:1 </updated-views>

          File upload, only after done (no progress)

          http://localhost:8080/ice-bug/block/receive-updated-views
          <updated-views>d9dGRkj2QEM5ZGqPWqwe7A:1 </updated-views>

          I was in the process of commenting out all of the JAAS references in the configuration xml files, so that I could verify that the application itself is not causing this problem. I believe I've commented everything out, so the next step would be to completely remove the jboss-web.xml file, since maybe its presence alone is causing problems.

          Show
          Mark Collette added a comment - On the main page that comes up, after you log in, there's a Commence button that will do 10 server pushes, 2 seconds apart, updating the same progress bar that the file upload uses. This will allow us to test any differences between regular server pushes and file upload server pushes. What I've found is that upon doing an action that should result in a server push, the browser receives a receive-updated-views message that references the current view. But, either the browser javascript does not act on this, or it does, but the server quietly discards the request for any updates. I think a phase listener should be installed to confirm that JSF lifecycles are happening to bring about the receive-updated-views. Then, debug should be added to the servlet to see if the browser is in fact contacting it for the updates. Maybe port listening software should be used, since I'm not sure the Firebug can differentiate between no server connection having been made, and one that has been made, but hasn't received a response. Server push, one of these every 2 seconds http://localhost:8080/ice-bug/block/receive-updated-views <updated-views>d9dGRkj2QEM5ZGqPWqwe7A:1 </updated-views> File upload, only after done (no progress) http://localhost:8080/ice-bug/block/receive-updated-views <updated-views>d9dGRkj2QEM5ZGqPWqwe7A:1 </updated-views> I was in the process of commenting out all of the JAAS references in the configuration xml files, so that I could verify that the application itself is not causing this problem. I believe I've commented everything out, so the next step would be to completely remove the jboss-web.xml file, since maybe its presence alone is causing problems.
          Hide
          Deryk Sinotte added a comment -

          Linking to ICE-3707 as work was done to support JAAS as part of the 1.8 DR2 release. The original test case that is attached to ICE-3900 and some of the other comments indicate that there were issues up to and including 1.8 DR1.

          I ran the case included in ICE-3900 and was able to see the problem. That .war file comes with the ICEfaces 1.7.2-SP1 jars. When I upgraded to 1.8.0 (the final release), 1.8.1, or the latest trunk, the problem was no longer present.

          I also took the regression test we have for ICE-3707 and ran it against both Tomcat and JBoss with JAAS configured. It includes menus, buttons, and file upload components that are protected with different levels of roles. It also runs with Ajax Push and I did not see the exception at all.

          Show
          Deryk Sinotte added a comment - Linking to ICE-3707 as work was done to support JAAS as part of the 1.8 DR2 release. The original test case that is attached to ICE-3900 and some of the other comments indicate that there were issues up to and including 1.8 DR1. I ran the case included in ICE-3900 and was able to see the problem. That .war file comes with the ICEfaces 1.7.2-SP1 jars. When I upgraded to 1.8.0 (the final release), 1.8.1, or the latest trunk, the problem was no longer present. I also took the regression test we have for ICE-3707 and ran it against both Tomcat and JBoss with JAAS configured. It includes menus, buttons, and file upload components that are protected with different levels of roles. It also runs with Ajax Push and I did not see the exception at all.
          Hide
          Deryk Sinotte added a comment -

          Marking as fixed in 1.8.0 (as per ICE-3707). Testing of the original case in ICE-3900 shows the problem is there in 1.7.2 SP1 but is not there in 1.8+ releases. If there is a different issue related to this case, we'll open a separate JIRA.

          Show
          Deryk Sinotte added a comment - Marking as fixed in 1.8.0 (as per ICE-3707 ). Testing of the original case in ICE-3900 shows the problem is there in 1.7.2 SP1 but is not there in 1.8+ releases. If there is a different issue related to this case, we'll open a separate JIRA.
          Hide
          Deryk Sinotte added a comment -

          Resolving as fixed.

          Show
          Deryk Sinotte added a comment - Resolving as fixed.
          Hide
          Silvano Maffeis added a comment -

          I tested ICEfaces 1.8.2 but file upload doesn't work if the JSF page holding the ice:inputFile
          component is protected by JAAS authentication. The moment I press the upload button, the logged user
          loses his authentication roles, and the InputFileController uploadFile method is never called.

          Show
          Silvano Maffeis added a comment - I tested ICEfaces 1.8.2 but file upload doesn't work if the JSF page holding the ice:inputFile component is protected by JAAS authentication. The moment I press the upload button, the logged user loses his authentication roles, and the InputFileController uploadFile method is never called.

            People

            • Assignee:
              Deryk Sinotte
              Reporter:
              Silvano Maffeis
            • Votes:
              3 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: