org.thymeleaf.testing.templateengine.context.web
Class SpringSecurityWebProcessingContextBuilder

Object
  extended by org.thymeleaf.testing.templateengine.context.web.WebProcessingContextBuilder
      extended by org.thymeleaf.testing.templateengine.context.web.SpringWebProcessingContextBuilder
          extended by org.thymeleaf.testing.templateengine.context.web.SpringSecurityWebProcessingContextBuilder
All Implemented Interfaces:
IProcessingContextBuilder

public class SpringSecurityWebProcessingContextBuilder
extends SpringWebProcessingContextBuilder


Field Summary
static String DEFAULT_AUTHENTICATION_MANAGER_BEAN_NAME
           
static String DEFAULT_PASSWORD_VARIABLE_NAME
           
static String DEFAULT_USERNAME_VARIABLE_NAME
           
 
Fields inherited from class org.thymeleaf.testing.templateengine.context.web.SpringWebProcessingContextBuilder
DEFAULT_APPLICATION_CONTEXT_CONFIG_LOCATION, DEFAULT_BINDING_MODEL_VARIABLE_NAME, DEFAULT_BINDING_VARIABLE_NAME
 
Fields inherited from class org.thymeleaf.testing.templateengine.context.web.WebProcessingContextBuilder
DEFAULT_LOCALE
 
Constructor Summary
SpringSecurityWebProcessingContextBuilder()
           
 
Method Summary
protected  org.springframework.security.core.Authentication getAuthentication(org.springframework.context.ApplicationContext applicationContext, ITest test, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, Locale locale, Map<String,Object> variables)
           Computes and returns a Spring Security Authentication object to be used for authenticating the desired user for testing purposes.
 String getAuthenticationManagerBeanName()
           
protected  void initSpring(org.springframework.context.ApplicationContext applicationContext, ITest test, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.ServletContext servletContext, Locale locale, Map<String,Object> variables)
           
 void setAuthenticationManagerBeanName(String authenticationManagerBeanName)
           
 
Methods inherited from class org.thymeleaf.testing.templateengine.context.web.SpringWebProcessingContextBuilder
createApplicationContext, doAdditionalVariableProcessing, doCreateWebContextInstance, getApplicationContextConfigLocation, getBindingVariableNames, getShareAppContextForAllTests, initBinder, initBindingResult, setApplicationContextConfigLocation, setShareAppContextForAllTests
 
Methods inherited from class org.thymeleaf.testing.templateengine.context.web.WebProcessingContextBuilder
build
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_AUTHENTICATION_MANAGER_BEAN_NAME

public static final String DEFAULT_AUTHENTICATION_MANAGER_BEAN_NAME
See Also:
Constant Field Values

DEFAULT_USERNAME_VARIABLE_NAME

public static final String DEFAULT_USERNAME_VARIABLE_NAME
See Also:
Constant Field Values

DEFAULT_PASSWORD_VARIABLE_NAME

public static final String DEFAULT_PASSWORD_VARIABLE_NAME
See Also:
Constant Field Values
Constructor Detail

SpringSecurityWebProcessingContextBuilder

public SpringSecurityWebProcessingContextBuilder()
Method Detail

getAuthenticationManagerBeanName

public String getAuthenticationManagerBeanName()

setAuthenticationManagerBeanName

public void setAuthenticationManagerBeanName(String authenticationManagerBeanName)

initSpring

protected final void initSpring(org.springframework.context.ApplicationContext applicationContext,
                                ITest test,
                                javax.servlet.http.HttpServletRequest request,
                                javax.servlet.http.HttpServletResponse response,
                                javax.servlet.ServletContext servletContext,
                                Locale locale,
                                Map<String,Object> variables)
Overrides:
initSpring in class SpringWebProcessingContextBuilder

getAuthentication

protected org.springframework.security.core.Authentication getAuthentication(org.springframework.context.ApplicationContext applicationContext,
                                                                             ITest test,
                                                                             javax.servlet.http.HttpServletRequest request,
                                                                             javax.servlet.http.HttpServletResponse response,
                                                                             javax.servlet.ServletContext servletContext,
                                                                             Locale locale,
                                                                             Map<String,Object> variables)

Computes and returns a Spring Security Authentication object to be used for authenticating the desired user for testing purposes.

By default, an UsernamePasswordAuthenticationToken object is returned, built with the values of two context variables:

If one or both of these variables are not present, null is returned and therefore no user will be considered to be authenticated.

Parameters:
applicationContext - the application context, already initialized
test - the ITest object
request - the HTTP request object
response - the HTTP response object
servletContext - the ServletContext object
locale - the locale being used for this test
variables - the context variables
Returns:
the Authentication object, null if no user is to be considered authenticated.


Copyright © 2013 The THYMELEAF team. All Rights Reserved.