View Javadoc

1   /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
2    *
3    * Licensed under the Apache License, Version 2.0 (the "License");
4    * you may not use this file except in compliance with the License.
5    * You may obtain a copy of the License at
6    *
7    *     http://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  
16  package org.springframework.security.ui;
17  
18  import org.springframework.security.AuthenticationException;
19  
20  import java.io.IOException;
21  
22  import javax.servlet.ServletException;
23  import javax.servlet.ServletRequest;
24  import javax.servlet.ServletResponse;
25  
26  
27  /**
28   * Used by {@link ExceptionTranslationFilter} to commence an authentication
29   * scheme.
30   *
31   * @author Ben Alex
32   * @version $Id: AuthenticationEntryPoint.java 2217 2007-10-27 00:45:30Z luke_t $
33   */
34  public interface AuthenticationEntryPoint {
35      //~ Methods ========================================================================================================
36  
37      /**
38       * Commences an authentication scheme.
39       * <p>
40       * <code>ExceptionTranslationFilter</code> will populate the <code>HttpSession</code> attribute named
41       * <code>AbstractProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY</code> with the requested target URL before
42       * calling this method.</p>
43       *
44       * <p>Implementations should modify the headers on the <code>ServletResponse</code> as necessary to
45       * commence the authentication process.</p>
46       *
47       * @param request that resulted in an <code>AuthenticationException</code>
48       * @param response so that the user agent can begin authentication
49       * @param authException that caused the invocation
50       *
51       */
52      void commence(ServletRequest request, ServletResponse response, AuthenticationException authException)
53          throws IOException, ServletException;
54  }