3 Replies Latest reply on Jun 4, 2004 7:41 AM by Alejandro Guzman

    Problem with users roles

    Alejandro Guzman Newbie

      Hi.... I have a problem with tomcat and Jboss

      I'm running my web app under JBoss 3.2.2 and tomcat 4.1.

      All users belong to users groups

      I think I configured everything about security in JBoss, in fact, when I put this sentences in my source code:
      System.out.println("User:"+request.getRemoteUser());
      System.out.println("User:"+request.getUserPrincipal().getName());
      I can see the user name that I entered in the login form,
      but this sentences return me false
      if (request.isUserInRole("users"))

      Does anybody know what happened ?? what's wrong ???
      How can I print the roles name of the user that signed in??

      Thanks in advance
      Alejandro.-

        • 1. Re: Problem with users roles
          gorano Newbie

          You have to post the config files before someone
          can have a look into what is wrong.

          /G

          • 2. Re: Problem with users roles
            Alejandro Guzman Newbie

            Hi, and sorry !!!

            Login-config.xml:
            <application-policy name = "Clinycas-domain">

            <login-module code = "com.procedatos.clinycas.seguridad.jboss.ClinycasDatabaseServerLoginModule" flag="required">
            <module-option name = "dsJndiName">java:/ClinyCasDS</module-option>
            <module-option name = "principalsQuery">
            SELECT dePassword AS Password FROM Usuario WHERE idUsuario=?
            </module-option>
            <module-option name = "rolesQuery">
            SELECT g.deGrupo AS Role,g.deGrupo AS RoleGroup
            FROM grupo g, detGrupoUsuario dg
            WHERE dg.idUsuario = ? AND dg.idGrupo = g.idGrupo
            </module-option>
            <module-option name = "hashAlgorithm">MD5</module-option>
            <module-option name = "hashEncoding">hex</module-option>
            <module-option name = "password-stacking">useFirstPass</module-option>
            <module-option name = "maxAttempts">3</module-option>
            <module-option name = "loginAttemptsQuery">SELECT cnIntentoLogon AS Intentos FROM Usuario WHERE idUsuario =?</module-option>
            <module-option name = "updateLoginAttemptsQuery">UPDATE Usuario SET cnIntentoLogon=? WHERE idUsuario =?</module-option>
            <module-option name = "lockAccountQuery">UPDATE Usuario SET feBloqueoUsuario=?, inBloqueo=? WHERE idUsuario =?</module-option>
            </login-module>

            </application-policy>

            web.xml:
            <security-constraint>
            <display-name>Usuarios</display-name>
            <web-resource-collection>
            <web-resource-name>comunes</web-resource-name>
            Paginas Comunes a Todos los Usuarios
            <url-pattern>/comunes/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
            <http-method>DELETE</http-method>
            <http-method>HEAD</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            </web-resource-collection>
            <web-resource-collection>
            <web-resource-name>recursos</web-resource-name>
            Plantillas de Documentos usadas por el Sistema
            <url-pattern>/recursos/scripts/*</url-pattern>
            <url-pattern>/recursos/layouts/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
            <http-method>DELETE</http-method>
            <http-method>HEAD</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            </web-resource-collection>
            <auth-constraint>
            Areas Compartidas por los Usuario que hacen Logon Interactivo dentro de Clinycas
            <role-name>*</role-name>
            </auth-constraint>
            <user-data-constraint>
            Esta area debe ser accesada a traves de SSL
            <transport-guarantee>NONE</transport-guarantee>
            </user-data-constraint>
            </security-constraint>
            <security-constraint>
            <display-name>Medicos Tratantes</display-name>
            <web-resource-collection>
            <web-resource-name>clinicas</web-resource-name>
            Paginas de uso de la Clinicas dentro del Sistema
            <url-pattern>/clinicas/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>PUT</http-method>
            <http-method>DELETE</http-method>
            <http-method>HEAD</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            </web-resource-collection>
            <auth-constraint>
            Paginas que solo deben ser accesadas por los Medicos Tratantes
            <role-name>Medicos Tratantes</role-name>
            </auth-constraint>
            <user-data-constraint>
            Esta area debe ser accesada a traves de SSL
            <transport-guarantee>NONE</transport-guarantee>
            </user-data-constraint>
            </security-constraint>
            <login-config>
            <auth-method>FORM</auth-method>
            <realm-name>Clinycas-domain</realm-name>
            <form-login-config>
            <form-login-page>/formInicioSesion.jsp</form-login-page>
            <form-error-page>/formErrorSesion.jsp</form-error-page>
            </form-login-config>
            </login-config>
            <security-role>
            Usuarios que son Medicos de los Centros Hospitalarios
            <role-name>Medicos Tratantes</role-name>
            </security-role>
            Todos los Usuarios Autenticados del Sistema Clinycas
            <role-name>Usuarios</role-name>
            </security-role>

            menu-config.xml:
            <!-- ========== M E N U C E N T R O H O S P I T A L A R I O =============== -->







            <!-- ========== M E N U E M P R E S A A S E G U R A D O R A =============== -->







            Any other file or any other information, please tell me..
            Regards,
            Alejandro.-

            • 3. Re: Problem with users roles
              Alejandro Guzman Newbie

              Again menu-config.xml


              <!-- ========== M E N U C E N T R O H O S P I T A L A R I O ===============
              Menu name="menuCentroHospitalario" title="menu.adm.centrohospitalario" image="images/item-new.png" >
              Item name="menuCentroHospitalarioAgregar" title="menu.generales.agregar"
              toolTip="Shows usage of the menu displayers using defaults."
              action="centroHospitalarioAction?accion=agregar"/>
              Item name="menuCentroHospitalarioConsultar" title="menu.generales.consultar"
              toolTip="Shows customized menu displays."
              page="/menutest2.jsp"/>
              Item name="menuCentroHospitalarioModificar" title="menu.generales.modificar"
              toolTip="Shows menu using CoolMenu3"
              page="/coolmenu1.jsp"/>
              Item name="menuCentroHospitalarioEliminar" title="menu.generales.eliminar"
              toolTip="Example use of menu disable and permission checking with CoolMenus."
              page="/permissionsForm.jsp"/>
              /Menu>

              <!-- ========== M E N U E M P R E S A A S E G U R A D O R A ===============
              Menu name="menuEmpresaAseguradora" title="menu.adm.empresaaseguradora" image="images/paste.png" roles="Usuarios">
              Item name="menuEmpresaAseguradoraAgregar" title="menu.generales.agregar"
              toolTip="Shows usage of the menu displayers using defaults."
              page="/formAgregarUsuario.jsp"/>
              Item name="menuEmpresaAseguradoraConsultar" title="menu.generales.consultar"
              toolTip="Shows customized menu displays."
              page="/menutest2.jsp"/>
              Item name="menuEmpresaAseguradoraModificar" title="menu.generales.modificar"
              toolTip="Shows menu using CoolMenu3"
              page="/coolmenu1.jsp"/>
              Item name="menuEmpresaAseguradoraEliminar" title="menu.generales.eliminar"
              toolTip="Example use of menu disable and permission checking with CoolMenus."
              page="/permissionsForm.jsp"/>
              /Menu>