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

          Silvano Maffeis created issue -
          Silvano Maffeis made changes -
          Field Original Value New Value
          Link This issue is duplicated by ICE-3900 [ ICE-3900 ]
          Ken Fyten made changes -
          Salesforce Case []
          Fix Version/s 1.8.2 [ 10190 ]
          Assignee Priority P3
          Assignee Mark Collette [ mark.collette ]
          Mark Collette made changes -
          Attachment ice-bug.war [ 11944 ]
          Ken Fyten made changes -
          Assignee Mark Collette [ mark.collette ] Deryk Sinotte [ deryk.sinotte ]
          Deryk Sinotte made changes -
          Link This issue depends on ICE-3707 [ ICE-3707 ]
          Deryk Sinotte made changes -
          Salesforce Case []
          Fix Version/s 1.8 [ 10161 ]
          Fix Version/s 1.8.2 [ 10190 ]
          Deryk Sinotte made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Silvano Maffeis made changes -
          Link This issue blocks ICE-5129 [ ICE-5129 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Priority P3

            People

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

              Dates

              • Created:
                Updated:
                Resolved: