コミュニティアチーブメントバーを展開する。

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

この会話は、活動がないためロックされています。新しい投稿を作成してください。

解決済み

Log out in AEM publish instance

Avatar

以前のコミュニティメンバー

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

1 受け入れられたソリューション

Avatar

正解者
Level 2

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

元の投稿で解決策を見る

6 返信

Avatar

以前のコミュニティメンバー

Any comments on this issue?

Avatar

以前のコミュニティメンバー

AEM experts any comments on this?

Avatar

正解者
Level 2

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

Avatar

Level 10

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. 

Avatar

以前のコミュニティメンバー

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

Avatar

以前のコミュニティメンバー

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/