01: /*
02: * Copyright (c) 2006 Your Corporation. All Rights Reserved.
03: */
04:
05: package com.technoetic.xplanner.actions;
06:
07: import javax.servlet.http.HttpServletRequest;
08: import javax.servlet.http.HttpServletResponse;
09:
10: import org.apache.struts.action.Action;
11: import org.apache.struts.action.ActionForm;
12: import org.apache.struts.action.ActionForward;
13: import org.apache.struts.action.ActionMapping;
14:
15: import com.technoetic.xplanner.security.Authenticator;
16: import com.technoetic.xplanner.security.CredentialCookie;
17: import com.technoetic.xplanner.security.SecurityHelper;
18:
19: public class LogoutAction extends Action {
20: private Authenticator authenticator;
21:
22: public void setAuthenticator(Authenticator authenticator) {
23: this .authenticator = authenticator;
24: }
25:
26: public ActionForward execute(ActionMapping actionMapping,
27: ActionForm actionForm,
28: HttpServletRequest httpServletRequest,
29: HttpServletResponse httpServletResponse) throws Exception {
30: authenticator.logout(httpServletRequest, SecurityHelper
31: .getRemoteUserId(httpServletRequest));
32: new CredentialCookie(httpServletRequest, httpServletResponse)
33: .remove();
34: return actionMapping.findForward("security/login");
35: }
36: }
|