2 Replies Latest reply on Apr 19, 2011 10:21 PM by Claudio Miranda

    Forwad authentication to external application

    Gabriel WILLEMS Newbie
      Hi,
      We are using GateIn VS3.0 for our intranet.
      Our GateIn is branched to a LDAP. We have other external applications branched on this LDAP but we don't have any SSO. We want to tranfer/forward authentication (credentials) from GateIn to external applications.
      We developped a http servlet filter mapped on "/login" url pattern. The filter catch the username and the password with succes. With them, we get a ticket from our external application. We want to make this ticket available for each portlet instance they need it during all the session.
      In this servlet filter, we tried to set the ticket in the session like that:
         --------------------------------------------
         HttpServletRequest httpRequest = (HttpServletRequest) request;
         HttpSession session = httpRequest.getSession(false);
         if (null != session){
           session.setAttribute("myTicket", myTicket);
          System.out.println("Session ID in filter"+session.getId());
         }
         --------------------------------------------
      But we didn't find how to retrieve the ticket in the managed bean of the JSFPortlet. We tried that:

       

         --------------------------------------------
         PortletSession session =  (PortletSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false);
         System.out.println("Session ID in managed bean (JSFPortlet)"+session.getId()); //display the same id as in the servlet filter
         System.out.println("myTicket (portlet_scope): "+session.getAttribute("myTicket"));   //display: null
         System.out.println("myTicket (app_scope): "+session.getAttribute("myTicket", PortletSession.APPLICATION_SCOPE));    //display: null
         --------------------------------------------
      We also explored the possibility to create our own TokenService (as a filter, like the "Remember me" filter) without succes. We did not find much documentation.
      Please, could you help us?
      Thank you in advance.

      Gabriel