1 /*** 2 * The contents of this file are subject to the Mozilla Public 3 * License Version 1.1 (the "License"); you may not use this file 4 * except in compliance with the License. You may obtain a copy of 5 * the License at http://www.mozilla.org/MPL/ 6 * 7 * Software distributed under the License is distributed on an "AS 8 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or 9 * implied. See the License for the specific language governing 10 * rights and limitations under the License. 11 * 12 * The Original Code is pow2Toolkit library. 13 * 14 * The Initial Owner of the Original Code is Power Of Two S.R.L. 15 * Portions created by Power Of Two S.R.L. are Copyright (C) Power Of Two S.R.L. 16 * All Rights Reserved. 17 * 18 * Contributor(s): 19 */ 20 package com.pow2.struts.action; 21 22 23 import javax.servlet.http.HttpServletRequest; 24 25 import com.pow2.user.UserManager; 26 27 28 /*** 29 * Base Action class with Session User validation. 30 * <br> 31 * If the current session does NOT provide a valid <code>com.pow2.user.User</code> 32 * reference, the <code>com.pow2.struts.action.ActionServlet</code> controller class 33 * returns the ActionForward object specified by 34 * <code>BaseAction.KEY_INVALID_SESSION</code>. 35 * 36 * @author Luca Fossato 37 * @version $Revision: 1.1.1.1 $ $Date: 2004/08/31 20:22:46 $ 38 */ 39 public class UserValidationAction extends BaseAction 40 { 41 /*** 42 * Check if the current session holds a valid 43 * <code>com.pow2.user.User</code> reference. 44 * 45 * @param HttpServletRequest the input request object 46 * @return true if the current session is valid; false otherwise 47 */ 48 protected boolean validateSession(HttpServletRequest request) 49 { 50 return (UserManager.instance().getUser(request) != null); 51 } 52 }