3 Replies Latest reply on Feb 14, 2007 2:56 AM by den74

    User Login

    works

      Hi
      I have a system that contains users, and that users need to login in portal.
      This user are in my database (MS-SQLServer), and i have a database view where show the users and his permission.

      How do I login in the portal using this users?

      How i get the user logged?

      Thanks




        • 1. Re: User Login
          den74

          > How do I login in the portal using this users?

          I have solved a similar problem after some tests, implementing my MyLoginModule that extends UsersRolesLoginModule and in this redefined some methds:
          (only some part of code)

          // to save locally the user
          protected String[] getUsernameAndPassword() throws LoginException {
          String[] userAndPassword = super.getUsernameAndPassword();
          this.user = userAndPassword[0];
          return userAndPassword;
          }

          // to use my validation
          protected boolean validatePassword(String arg0, String arg1) {
          boolean result = myValidation.login(this.user, arg0);
          return result;
          }

          remember you have to configure portal to use your class:
          in jbPortal/server/default/conf/login-config.xml
          add you application policy like


          <application-policy name = "My_Authentication">

          <login-module code ="it.deltadator.security.auth.spi.MyLoginModule"
          flag = "required" >
          <module-option name="additionalRole">Authenticated</module-option>
          </login-module>

          </application-policy>

          and then use it as security domain changing reference in
          server\default\deploy\jboss-portal.sar\portal-server.war\WEB-INF\jboss-web.xml

          > How i get the user logged?

          In your class you can access to user logged using getUserPrincipal from ProtletRequest


          hope you get it useful

          • 2. Re: User Login
            works

            Ok...but where i put that implementation?

            I´m working with iframes in portlets....may i get the user logged using request.getUserPrincipal in the Jsp inside iframe?

            Existi other method to do login, without extends UsersRolesLoginModule?

            thanks

            • 3. Re: User Login
              den74

              > Ok...but where i put that implementation?

              It is indipendend from portlet, i mean this way is always used to log in portal so you just need to make a jar and put into server/default/lib of jbossportal ( i made like this and it works)