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.riot.runtime.RiotRuntime; 30 import org.riotfamily.riot.runtime.RiotRuntimeAware; 31 import org.riotfamily.riot.security.auth.RiotUser; 32 33 39 public class LoginInterceptor extends AccessControlInterceptor 40 implements RiotRuntimeAware { 41 42 private String loginUrl; 43 44 private RiotRuntime runtime; 45 46 public void setLoginUrl(String loginUrl) { 47 this.loginUrl = loginUrl; 48 } 49 50 public void setRiotRuntime(RiotRuntime runtime) { 51 this.runtime = runtime; 52 } 53 54 58 protected boolean isAuthorized(HttpServletRequest request, 59 HttpServletResponse response, RiotUser user) throws Exception { 60 61 if (user != null) { 62 return true; 63 } 64 else { 65 response.sendRedirect(response.encodeRedirectURL( 66 request.getContextPath() + runtime.getServletPrefix() 67 + loginUrl)); 68 69 return false; 70 } 71 } 72 73 } 74 | Popular Tags |