0 Replies Latest reply on Aug 22, 2005 7:28 AM by Gary Bennett

    Portlet security

    Gary Bennett Newbie

      I've been trying to configure security on my portlet. I based this on the test portlet which works fine by itself. However my portlet always returns true when I call hasPermission

      No matter what permission name I ask for hasPermission always returns true.

      Help would be appreciated

      Thanks

      The java I am using is:-

      protected void doView(JBossRenderRequest req, JBossRenderResponse resp)
      throws PortletException, PortletSecurityException, IOException
      {
      PortletURL authenticateURL = resp.createActionURL();
      authenticateURL.setParameter("authenticate", "true");
      resp.setContentType("text/html");
      PrintWriter writer = resp.getWriter();
      User user = req.getUser();
      if(user != null)
      {
      System.out.println("has global permission 1 " + req.hasPermission("User") );
      System.out.println("has global permission 2 " + req.hasPermission("Administrator") );

      and the jboss-portlet.xml security section is:-


      <content-provider-class>com.premita.dcp.report.portlet.ReportModelContentProvider</content-provider-class>
      <permission-description>
      <permission-name>Administrator</permission-name>
      This is description of the permission #1
      </permission-description>
      <permission-description>
      <permission-name>User</permission-name>
      This is description of the permission #2
      </permission-description>
      <permission-description>
      <permission-name>Perm3</permission-name>
      </permission-description>


      /

      <permission-name>Administrator</permission-name>
      <role-name>Admin</role-name>


      <permission-name>User</permission-name>
      <role-name>User</role-name>