Module thymeleaf.testing.spring6
Class SpringSecurityMVCWebProcessingContextBuilder
Object
org.thymeleaf.testing.templateengine.context.web.WebProcessingContextBuilder
org.thymeleaf.testing.templateengine.spring6.context.web.SpringMVCWebProcessingContextBuilder
org.thymeleaf.testing.templateengine.spring6.context.web.SpringSecurityMVCWebProcessingContextBuilder
- All Implemented Interfaces:
org.thymeleaf.testing.templateengine.context.IProcessingContextBuilder
public class SpringSecurityMVCWebProcessingContextBuilder
extends SpringMVCWebProcessingContextBuilder
-
Field Summary
FieldsFields inherited from class org.thymeleaf.testing.templateengine.spring6.context.web.SpringMVCWebProcessingContextBuilder
DEFAULT_APPLICATION_CONTEXT_CONFIG_LOCATION, DEFAULT_BINDING_MODEL_VARIABLE_NAME
Fields inherited from class org.thymeleaf.testing.templateengine.context.web.WebProcessingContextBuilder
DEFAULT_LOCALE
-
Constructor Summary
ConstructorsConstructorDescriptionSpringSecurityMVCWebProcessingContextBuilder
(org.thymeleaf.testing.templateengine.context.web.ITestWebExchangeBuilder testWebExchangeBuilder) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.security.core.Authentication
getAuthentication
(org.springframework.context.ApplicationContext applicationContext, org.thymeleaf.testing.templateengine.testable.ITest test, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.ServletContext servletContext, Locale locale, Map<String, Object> variables) Computes and returns a Spring SecurityAuthentication
object to be used for authenticating the desired user for testing purposes.protected final void
initSpring
(org.springframework.context.ApplicationContext applicationContext, org.thymeleaf.testing.templateengine.testable.ITest test, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.ServletContext servletContext, Locale locale, Map<String, Object> variables) void
setAuthenticationManagerBeanName
(String authenticationManagerBeanName) Methods inherited from class org.thymeleaf.testing.templateengine.spring6.context.web.SpringMVCWebProcessingContextBuilder
createApplicationContext, doAdditionalVariableProcessing, getApplicationContextConfigLocation, getShareAppContextForAllTests, initBinder, initBindingResult, setApplicationContextConfigLocation, setShareAppContextForAllTests
Methods inherited from class org.thymeleaf.testing.templateengine.context.web.WebProcessingContextBuilder
build, doCreateWebContextInstance
-
Field Details
-
DEFAULT_AUTHENTICATION_MANAGER_BEAN_NAME
- See Also:
-
DEFAULT_USERNAME_VARIABLE_NAME
- See Also:
-
DEFAULT_PASSWORD_VARIABLE_NAME
- See Also:
-
-
Constructor Details
-
SpringSecurityMVCWebProcessingContextBuilder
public SpringSecurityMVCWebProcessingContextBuilder(org.thymeleaf.testing.templateengine.context.web.ITestWebExchangeBuilder testWebExchangeBuilder) -
SpringSecurityMVCWebProcessingContextBuilder
public SpringSecurityMVCWebProcessingContextBuilder()
-
-
Method Details
-
getAuthenticationManagerBeanName
-
setAuthenticationManagerBeanName
-
initSpring
protected final void initSpring(org.springframework.context.ApplicationContext applicationContext, org.thymeleaf.testing.templateengine.testable.ITest test, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.servlet.ServletContext servletContext, Locale locale, Map<String, Object> variables) - Overrides:
initSpring
in classSpringMVCWebProcessingContextBuilder
-
getAuthentication
protected org.springframework.security.core.Authentication getAuthentication(org.springframework.context.ApplicationContext applicationContext, org.thymeleaf.testing.templateengine.testable.ITest test, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, jakarta.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:j_username
for the user name.j_password
for the user password.
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 initializedtest
- theITest
objectrequest
- the HTTP request objectresponse
- the HTTP response objectservletContext
- the ServletContext objectlocale
- the locale being used for this testvariables
- the context variables- Returns:
- the Authentication object, null if no user is to be considered authenticated.
-