AnsweredAssumed Answered

Loging in from Intranet - Language problem

Question asked by agey on May 20, 2009
Latest reply on Jun 11, 2009 by jlabuelo
Good Morning all

We are trying to integrate Alfresco 3.0 with our Intranet. To do so we are not using LDAP, we just copied the users from our intranet and created them in Alfresco 3.0 with the same Login/password.

What we want to get is creating a link in our index page of the Intranet to alfresco 3.0 and that link should redirect the webbrowser to Alfresco not to the Alfresco Login page, but to the "My alfresco" of the user.

Basically we want to get the user to be authenticated in the Intranet Login Page, and then be able to go to all the other applications linked from there but not using LDAP.

To do so we have created a JavaBean (Code Below) that is included in a link of the index page of the Intranet, and with it we send the order to Alfresco to log in with Login and Password.

This works fine and the user once he clicks in the link of the intranet, gets logged in Alfresco, however we have a problem with the Language, as we have Spanish installed as preferred language, and with this method we get the user to get loged in with English as language.

We have configured the Web-Client-Config-Custom.xml to use Spanish as primary language using
<config evaluator="string-compare" condition="Languages" replace="true">
However we still get the users to log in English..

Any ideas of how we should do it to get the users loging in Spanish?? Is there something in the code that we should include to force Alfresco to log in "Spanish"?

Thanks a lot for your help in advance



//This function obtains calls the authentication process and once the user is aunthenticated goes to the "My Alfresco" page

public void doGet(HttpServletRequest request,
         HttpServletResponse response)
   throws IOException, ServletException {
      
      /* Get value of parameter "userName". */
      String sesionID = request.getParameter("sesionId");      
      
                //This line performs the authentication using the "autentificar" function using the login and password in the 
                //object Session Id
      User usuario = this.getConfigurationService().autentificar(sesionID);
      HttpSession session = request.getSession();
      
      session.setAttribute(AuthenticationHelper.AUTHENTICATION_USER, usuario);
      
      
      response.sendRedirect(request.getContextPath() + FACES_SERVLET + "/jsp/dashboards/container.jsp");
               

            
   }

This is the function that performs the authentication process…. Shall we include something to force the "Spanish" language here??

public User autentificar(String sesionId)   {
      Parametros user = parametrosDAO.listParametro(sesionId,ExpedienteModel.PARAMETRO_USER);
      Parametros pass = parametrosDAO.listParametro(sesionId,ExpedienteModel.PARAMETRO_PASS);

      //System.out.println(user);
      //System.out.println(pass);
      parametrosDAO.eliminarParametros(sesionId);
      try {
         this.serviceRegistry.getAuthenticationService().authenticate(user.getValor(), pass.getValor().toCharArray());
         //      this.authenticationComponent.authenticate(user.getValor(), pass.getValor().toCharArray());                  

      } catch (Exception e) {
         System.out.println("Usuario incorrecto:"+user.getValor());
         return null;
      }

      String currentUser = this.serviceRegistry.getAuthenticationService().getCurrentUserName();

      User usuario = new User(
            currentUser,
            this.serviceRegistry.getAuthenticationService().getCurrentTicket(),
            this.serviceRegistry.getPersonService().getPerson(currentUser));

      System.out.println("Curernt user:"+currentUser);

      // Get ticket
      //String ticket = this.serviceRegistry.getAuthenticationService().getCurrentTicket();
      //        String ticket = pubAuthenticationService.getCurrentTicket();
      //        assertEquals("andy", ticketComponent.getAuthorityForTicket(ticket));

      return usuario;
   }

Outcomes