Hi,
I am seeing one issue related to log out in AEM 5.6.1. Basically in the sling logout servlet after logging out always it is redirecting to root path that is geometixx outdoors home page. If I want to replace We can do it by configuring rootservlet mapping. But it is always one logout page. Is this not a limitation? If I am developing more than 1 site out of the AEM publish instance and if I want to configure 2 different logout pages is there any configuration way?
One thing when I checked at the slingauthenticator implementation, inside logout method sendRedirect method is called which is redirecting to the root. We need to override whole logout method.
Please suggest if there is any approach for configuring different logout pages.
Thanks,
Maruthi
Solved! Go to Solution.
Hi,
I had handled this using a servlet [LogoutServlet]. This website I am working is a multi lingual one and the user should remain on the same page where logout is called.
So while generating the logout link I add one selector to the logout url so that LogoutServlet can pick that request.
e.g. http://<server>/en/home.logout.html?resource=%2Fen%2Fhome.logout.html
The "resource" query parameter is used the the SlingAuthenticator for redirecting the user after logout. I have some other requirements as well and code for which I have removed here.
Now here is the minimal LogoutServlet that could work for you.
/** * This servlet calls the SlingAuthenticator's logout method which deletes the * login-token cookie and ultimately logout the user. * * @author Rakesh.Kumar * */ @SlingServlet(description = "This servlet calls the SlingAuthenticator's logout method.", resourceTypes = { "sling:resourceType of the page you are on" }, selectors = { "logout" }, extensions = { "html" }, methods = { HttpConstants.METHOD_GET }) public class LogoutServlet extends SlingSafeMethodsServlet { /** * serialVersionUID for this class. */ private static final long serialVersionUID = 2948831032750262626L; /** * SlingAuthenticator reference Injected by the OSGi system. */ @Reference private Authenticator slingAuthenticator; /** * HTTP GET implementation for calling SlingAuthenticator's logout method . * * @param request * {@link SlingHttpServletRequest} * @param response * {@link SlingHttpServletResponse} */ @Override protected void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException { this.slingAuthenticator.logout(request, response); // May be some handling for moving from HTTPS to HTTP } }
Hope this helps,
Rakesh
Any comments on this issue?
Views
Replies
Total Likes
AEM experts any comments on this?
Views
Replies
Total Likes
Hi,
I had handled this using a servlet [LogoutServlet]. This website I am working is a multi lingual one and the user should remain on the same page where logout is called.
So while generating the logout link I add one selector to the logout url so that LogoutServlet can pick that request.
e.g. http://<server>/en/home.logout.html?resource=%2Fen%2Fhome.logout.html
The "resource" query parameter is used the the SlingAuthenticator for redirecting the user after logout. I have some other requirements as well and code for which I have removed here.
Now here is the minimal LogoutServlet that could work for you.
/** * This servlet calls the SlingAuthenticator's logout method which deletes the * login-token cookie and ultimately logout the user. * * @author Rakesh.Kumar * */ @SlingServlet(description = "This servlet calls the SlingAuthenticator's logout method.", resourceTypes = { "sling:resourceType of the page you are on" }, selectors = { "logout" }, extensions = { "html" }, methods = { HttpConstants.METHOD_GET }) public class LogoutServlet extends SlingSafeMethodsServlet { /** * serialVersionUID for this class. */ private static final long serialVersionUID = 2948831032750262626L; /** * SlingAuthenticator reference Injected by the OSGi system. */ @Reference private Authenticator slingAuthenticator; /** * HTTP GET implementation for calling SlingAuthenticator's logout method . * * @param request * {@link SlingHttpServletRequest} * @param response * {@link SlingHttpServletResponse} */ @Override protected void doGet(final SlingHttpServletRequest request, final SlingHttpServletResponse response) throws ServletException, IOException { this.slingAuthenticator.logout(request, response); // May be some handling for moving from HTTPS to HTTP } }
Hope this helps,
Rakesh
Take a look at this community article:
http://saraindia.wordpress.com/2012/08/09/logout-on-a-publish-instance/
Let me know if this topic is helpful.
Views
Replies
Total Likes
Hi Smac,
That link explains the problem in AEM. This seems to be issue in AEM. Can you please look in to this issue.
Thanks,
Maruthi
Views
Replies
Total Likes
smacdonald2008 wrote...
Take a look at this community article:
http://saraindia.wordpress.com/2012/08/09/logout-on-a-publish-instance/
Let me know if this topic is helpful.
Updated URL:
https://saraindia.wordpress.com/2012/08/09/logout-on-a-publish-instance/
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies