I tested this on Alfresco Community 4.2.e.
- When mousing over the Logout link in Alfresco Share, you can see it wants to send you to "http://<host>:<port>/share/page/dologout".
- Grepping the code base for files that contain /dologout url, the following files comes up:
- WEB-INF/classes/alfresco/share-config.xml:
- /dologout
- WEB-INF/classes/alfresco/share-security-config.xml:
/page/dologout(\?.+)? - WEB-INF/classes/alfresco/slingshot-application-context.xml: /dologout/**=logoutController
- We'll only need to override definitions in slingshot-application-context.xml, since this is where the logoutController bean is defined, and where it is used to controller the /dologout mapping. Reference the two bean with definition:
- <bean id="webframeworkHandlerMappings" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" abstract="true">
- <bean id="'logoutController" class="org.aflresco.web.site.servlet.SlingshotLogoutController">
- To override slingshot-application-context.xml, we'll have to use web-extension/custom-slingshot-application-context.xml. To minimize other cascading changes, we will not change the /dologout url, we will extend the spring bean that is implementing the /dologout url
- Copy over the two beans from slingshot-application-context.xml from the previous step.
- Change the "logoutController" beanId name with a custom one (let's call it cherryshoeLogoutController), and extend it with a custom java class (let's call it CherryShoeSlingshotLogoutController.java).
For the "webframeworkHandlerMappings" beanId, change the following in the "mappings" property. /dologout/**= cherryshoeLogoutController - The org.alfresco.web.site.servlet.SlingshotLogoutController is located in alfresco-share-<version>.jar. Make a copy of the java code from there and name it CherryShoeSlingshotLogoutController.java.
- CherryShoeSlingshotLogoutController should extend SlingshotLogoutController, to keep the existing functionality.
- Make modifications to "handleRequestInternal" method - override the finally block to redirect to a custom cherryshoe-logout.jsp page that is located in the share context root folder.
finally { // Copy the code from this class's parent parent that does additional logout capabiliites, // so we can control the redirect page AuthenticationUtil.logout(request, response); // redirect to a custom jsp page in the root of the website response.sendRedirect(request.getContextPath() + "/cherryshoe-logout.jsp"); return null; //return super.handleRequestInternal(request, response); }
- Create a custom cherryshoe-logout.jsp page and save it under the share context root folder.
Can you describe the changes that you have made?
ReplyDeleteIf you debug or put debug statements inside CherryShoeSlingshotLogoutController before and after handleRequestInternal's send Redirect code, does it print it out in the log or console window? Is sendRedirect enabled?
Is AuthenticationUtil.logout enabled and prior to sendRedirect?
Did you create a custom.jsp page in the root context of the share webapp folder?
How do you customize alfresco, do you use amps, if so, has the custom java code been redeployed in the custom jar in the amp into share.war?
Thanks
Judy
Wonderful! You are most welcome.
ReplyDeleteRegards
Judy