1 2 Previous Next 23 Replies Latest reply on May 4, 2009 3:06 PM by mrv cnkl

    Redirect after logout

    m m Newbie

      Hello,

      I want to know where I can modify the redirection url after an user log out.

      At time, when an user log out, he is redirect to default portal page. I want to redirect to my portal.

      I'm use Jboss portal 2.6 with Jboss AS 4.0.5.

      Any solutions ?

      Thanks.

      PS: Sorry for my bad English.

        • 1. Re: Redirect after logout
          m m Newbie

          Nobody knows who can i modify this ?

          Thanks.

          PS: Sorry for my bad English.

          • 2. Re: Redirect after logout
            Burkhard Vogt Newbie

            In Portal 2.4 we did it by a portlet extending JBossPortlet, which is placed on every page. This portlet renders either a ling or logout link. On logout you can pass the redirect URL to JBossActionResponse.signOut(String).

            May be 2.6 has a smarter solution for integrating this using the pageInterceptor?

            Hope this helps a bit.

            • 3. Re: Redirect after logout
              Viet Master

              In 2.6 you can rewrite the header and tab since they are JSP files. Have a look at http://docs.jboss.com/jbportal/v2.6/reference-guide/html/themeandlayouts.html#d0e8202



              "maiky" wrote:
              Hello,

              I want to know where I can modify the redirection url after an user log out.

              At time, when an user log out, he is redirect to default portal page. I want to redirect to my portal.

              I'm use Jboss portal 2.6 with Jboss AS 4.0.5.

              Any solutions ?

              Thanks.

              PS: Sorry for my bad English.


              • 4. Re: Redirect after logout
                m m Newbie

                I try to rewrite the header.jsp with the example of the doc but have erros.

                <%@ page import="org.jboss.portal.identity.User" %>
                <%@ page import="org.jboss.portal.api.PortalURL" %>
                
                <%
                 User user = (User) request.getAttribute("org.jboss.portal.header.USER");
                 PortalURL signOutURL = (PortalURL)request.getAttribute("org.jboss.portal.header.SIGN_OUT_URL");
                 PortalURL loginURL = (PortalURL)request.getAttribute("org.jboss.portal.header.LOGIN_URL");
                
                
                 if (user == null)
                 {
                %>
                 <a href="<%= loginURL %>">Login</a>
                <%
                 }
                 else
                 {
                %>
                Logged in as: <%= user.getUserName() %>
                <br/>
                <a href="<%= signOutURL %>">Logout</a>
                <%
                 }
                %>


                Errors :
                15:25:37,046 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
                java.lang.ClassCastException: java.lang.String
                 at org.apache.jsp.WEB_002dINF.jsp.header.header_jsp._jspService(header_jsp.java:49)
                 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:334)
                 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
                 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
                 at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
                ++ MORE...

                15:25:37,046 ERROR [STDERR] org.apache.jasper.JasperException: Exception in JSP: /WEB-INF/jsp/header/header.jsp:6
                
                3:
                4: <%
                5: User user = (User) request.getAttribute("org.jboss.portal.header.USER");
                6: PortalURL signOutURL = (PortalURL)request.getAttribute("org.jboss.portal.header.SIGN_OUT_URL");
                7: PortalURL loginURL = (PortalURL)request.getAttribute("org.jboss.portal.header.LOGIN_URL");
                8:
                9:
                
                
                Stacktrace:
                15:25:37,046 ERROR [STDERR] at org.apache.jasper.servlet.JspServletWrapper.handleJspException
                ++ MORE ...


                If I understand the request.getAttribute("org.jboss.portal.header.SIGN_OUT_URL") is a String, not a PortalURL.

                So I can't use the portalURL methods. I just can get the SIGN_OUT_URL in a String.

                May be 2.6 has a smarter solution for integrating this using the pageInterceptor?


                Sorry I don't understand what I must do, can you explain plz ? :(


                Any Solutions to redirect?

                Thanks.

                PS: Sorry for my bad English

                • 6. Re: Redirect after logout
                  m m Newbie

                  I can redirect but I want redirect after logout. with no new clic.

                  When I click on logout, I want to redirect to my home page with no User log in.

                  At this time when I'm using the sign_out_url, I'm redirect to default portal.

                  If I can't change the sign_out_url, can I log out an user with a function ? and after redirect to my home page ?

                  I think a function exist for log out ?

                  Thks.

                  PS: Sorry for my bad English.

                  • 7. Re: Redirect after logout
                    Viet Master

                    I see what you mean. What you don't have is a way to create the proper sign out URL ?

                    "maiky" wrote:
                    I can redirect but I want redirect after logout. with no new clic.

                    When I click on logout, I want to redirect to my home page with no User log in.

                    At this time when I'm using the sign_out_url, I'm redirect to default portal.

                    If I can't change the sign_out_url, can I log out an user with a function ? and after redirect to my home page ?

                    I think a function exist for log out ?

                    Thks.

                    PS: Sorry for my bad English.


                    • 8. Re: Redirect after logout
                      m m Newbie

                      Yes I want to create a sign_out_url that redirect me to my proper home page when a user click on logout (with no user authentificated after).

                      • 9. Re: Redirect after logout
                        Viet Master

                        Unfortunately, technically it is not possible today using the API (that we support). It could be possible using a CommandFactory that would create SignOutCommand instances. The CommandFactory is what translates URL into commands which are executed by the portal. The CommandFactory could be mapped to "/signout" or "/signout?location=xxx" pretty much easily. Also an URLFactory that would translate commands to URL (the reverse mechanism of CommandFactory) should be done too.

                        • 10. Re: Redirect after logout
                          m m Newbie

                          Thks I go to see what is it ans try to understand what must I do.

                          There is no methods to logout ? of any library ?

                          Thks.

                          PS: Sorry for my bad English.

                          • 11. Re: Redirect after logout
                            Gyanendra Hyoju Newbie

                            any updates on this issue.

                            how to map CommandFactory to "/signout" or "/signout?location=xxx"

                            Thanks,
                            gyan

                            • 12. Re: Redirect after logout
                              Thomas Heute Master

                              I created a Hira to have this out of the box in 2.6.2
                              If someone feels like contributing this, that would be welcome.

                              • 13. Re: Redirect after logout
                                Gyanendra Hyoju Newbie

                                hi thomas,

                                I need this functionality. If you let me know where to begin then I might be able to contribute.

                                thank you very much.
                                gyan

                                • 14. Re: Redirect after logout
                                  pushpita bhattacharjee Newbie

                                  hi

                                  i am also facing the same problem if i delete the default portal the logout throws exception so what to do ? i want to delete the default portal.

                                  thanks

                                  1 2 Previous Next