org.springframework.security.web.authentication.www
Class BasicAuthenticationEntryPoint

java.lang.Object
  extended by org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint
All Implemented Interfaces:
InitializingBean, AuthenticationEntryPoint

public class BasicAuthenticationEntryPoint
extends Object
implements AuthenticationEntryPoint, InitializingBean

Used by the ExceptionTraslationFilter to commence authentication via the BasicAuthenticationFilter.

Once a user agent is authenticated using BASIC authentication, logout requires that the browser be closed or an unauthorized (401) header be sent. The simplest way of achieving the latter is to call the commence(HttpServletRequest, HttpServletResponse, AuthenticationException) method below. This will indicate to the browser its credentials are no longer authorized, causing it to prompt the user to login again.

Version:
$Id: BasicAuthenticationEntryPoint.java 3928 2009-10-07 14:43:55Z ltaylor $
Author:
Ben Alex

Constructor Summary
BasicAuthenticationEntryPoint()
           
 
Method Summary
 void afterPropertiesSet()
           
 void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException)
          Commences an authentication scheme.
 String getRealmName()
           
 void setRealmName(String realmName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicAuthenticationEntryPoint

public BasicAuthenticationEntryPoint()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

commence

public void commence(HttpServletRequest request,
                     HttpServletResponse response,
                     AuthenticationException authException)
              throws IOException,
                     ServletException
Description copied from interface: AuthenticationEntryPoint
Commences an authentication scheme.

ExceptionTranslationFilter will populate the HttpSession attribute named AbstractAuthenticationProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY with the requested target URL before calling this method.

Implementations should modify the headers on the ServletResponse as necessary to commence the authentication process.

Specified by:
commence in interface AuthenticationEntryPoint
Parameters:
request - that resulted in an AuthenticationException
response - so that the user agent can begin authentication
authException - that caused the invocation
Throws:
IOException
ServletException

getRealmName

public String getRealmName()

setRealmName

public void setRealmName(String realmName)


Copyright © 2004-2009 SpringSource, Inc. All Rights Reserved.