Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Custom logout page per site (multi site)

Avatar

Avatar
Validate 10
Level 2
SurendraKonatha
Level 2

Likes

5 likes

Total Posts

63 posts

Correct Reply

6 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
SurendraKonatha
Level 2

Likes

5 likes

Total Posts

63 posts

Correct Reply

6 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
SurendraKonatha
Level 2

28-10-2015

We have 3 different sites.. SandA, SandB, SandC and each of them have different Login pages. How can i configure/code the "Logout" link on the page?

So if i'm on site: SandA, the href for Logout is defined like this http://localhost:4502/system/sling/logout but this is using the RootMappingServlet and taking all Logout links on all sites to the one i configured. How can i solve this?

There were several posts but they did not discuss on configuring logout urls for multi-sites

Accepted Solutions (0)

Answers (2)

Answers (2)

Avatar

Avatar
Validate 10
Level 2
SurendraKonatha
Level 2

Likes

5 likes

Total Posts

63 posts

Correct Reply

6 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile

Avatar
Validate 10
Level 2
SurendraKonatha
Level 2

Likes

5 likes

Total Posts

63 posts

Correct Reply

6 solutions
Top badges earned
Validate 10
Validate 1
Boost 5
Boost 3
Boost 1
View profile
SurendraKonatha
Level 2

28-10-2015

I'd be interested to learn more on writing a custom RootMappingServlet. Can you send me a brief example? 

I did try to write a custom LogoutServlet, define a custom url instead of using "/system/sling/logout", and used Authenticator.logout(request, response). This method works but the problem is that the Response gets invalidated and we cannot use a custom Redirect url. Whatever is defined in the RootMappingServlet is picked to show. This works good if you have one site. But for multi-site this was not the case.

One solution that worked for me:

We can add "resource" param to "/system/sling/logout" defining the path that should load after logout. No need to write any additional code. 

<a href="https://forums.adobe.com/system/sling/logout?resource=/content/yoursite/en.html">Logout</a>

If you have multiple sites, then.. your Root Mapping Servlet can be the default value (for us it was : /projects.html)

<a href="https://forums.adobe.com/system/sling/logout?resource=/content/yoursite1/en.html">Logout</a> <a href="https://forums.adobe.com/system/sling/logout?resource=/content/yoursite2/en.html">Logout</a>

Avatar

Avatar
Validate 25
MVP
bsloki
MVP

Likes

182 likes

Total Posts

1,859 posts

Correct Reply

545 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 50
Boost 5
View profile

Avatar
Validate 25
MVP
bsloki
MVP

Likes

182 likes

Total Posts

1,859 posts

Correct Reply

545 solutions
Top badges earned
Validate 25
Validate 10
Validate 1
Boost 50
Boost 5
View profile
bsloki
MVP

28-10-2015

You can write a custom 'RootMappingServlet' and based on the page where the logout is hit, you can have the logout page configured.