cancel
Showing results for 
Search instead for 
Did you mean: 

Logout trigger by URL

simon
Champ in-the-making
Champ in-the-making
Hi,

Is it possible to trigger a logout for the current user in a Freemarker template? Don't want to make anything complicated, only triggering the logout like the link in the web client. Tried to copy the form from the webclient but it's probably a little more complicated as this.

Can this be done?
4 REPLIES 4

gavinc
Champ in-the-making
Champ in-the-making
It can't be done out-of-the-box but it should be fairly easy to achieve with some Java coding.

You'll need to write a small servlet that can get access to the LoginBean and call the logout method.

You'll need to get hold of a FacesContext object in the servlet, retrieve the bean and call the method. A similar thing is done in ExternalAccessServlet, you can use this as a guide.

Then from your freemarker script you can just add a link to the servlet.

Hope that helps.

kevinr
Star Contributor
Star Contributor
Yes it can. There is a special servlet for a few specific things like browse, space details, document details and also logout.

The form of the URL is:
http://<server>/alfresco/navigate/logout

See the ExternalAccessServlet wiki docs for more info.

Thanks,

Kevin

gavinc
Champ in-the-making
Champ in-the-making
Ahh, there you go I learnt something too  Smiley Very Happy

simon
Champ in-the-making
Champ in-the-making
Thanks guys! I'm sorry Gavin but Kevins answer looks nicer… Smiley Wink Tested it and it works, great.