1 24 package org.riotfamily.riot.security.session; 25 26 import javax.servlet.http.HttpServletRequest ; 27 import javax.servlet.http.HttpServletResponse ; 28 29 import org.riotfamily.common.web.util.OncePerRequestInterceptor; 30 import org.riotfamily.riot.security.auth.RiotUser; 31 32 38 public class AccessControlInterceptor extends OncePerRequestInterceptor { 39 40 public boolean preHandleOnce(HttpServletRequest request, 41 HttpServletResponse response, Object handler) throws Exception { 42 43 RiotUser user = LoginManager.getUser(request); 44 SecurityContext.bindUserToCurrentThread(user); 45 return isAuthorized(request, response, user); 46 } 47 48 protected boolean isAuthorized(HttpServletRequest request, 49 HttpServletResponse response, RiotUser user) throws Exception { 50 51 return true; 52 } 53 54 public final void afterLastCompletion(HttpServletRequest request, 55 HttpServletResponse response, Object handler, Exception ex) 56 throws Exception { 57 58 SecurityContext.resetUser(); 59 } 60 61 } 62 | Popular Tags |