1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity;
17
18 import org.acegisecurity.intercept.web.AuthenticationEntryPoint;
19
20 import java.io.IOException;
21
22 import javax.servlet.ServletException;
23 import javax.servlet.ServletRequest;
24 import javax.servlet.ServletResponse;
25 import javax.servlet.http.HttpServletRequest;
26 import javax.servlet.http.HttpServletResponse;
27
28
29 /***
30 * Performs a HTTP redirect to the constructor-indicated URL.
31 *
32 * @author Ben Alex
33 * @version $Id: MockAuthenticationEntryPoint.java,v 1.3 2005/11/17 00:55:47 benalex Exp $
34 */
35 public class MockAuthenticationEntryPoint implements AuthenticationEntryPoint {
36
37
38 private String url;
39
40
41
42 public MockAuthenticationEntryPoint(String url) {
43 this.url = url;
44 }
45
46 private MockAuthenticationEntryPoint() {
47 super();
48 }
49
50
51
52 public void commence(ServletRequest request, ServletResponse response,
53 AuthenticationException authenticationException)
54 throws IOException, ServletException {
55 ((HttpServletResponse) response).sendRedirect(((HttpServletRequest) request)
56 .getContextPath() + url);
57 }
58 }