Class WebTestUtils
java.lang.Object
org.springframework.security.test.web.support.WebTestUtils
A utility class for testing spring security
- Since:
- 4.0
- Author:
- Rob Winch
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.springframework.security.web.csrf.CsrfTokenRepositorygetCsrfTokenRepository(javax.servlet.http.HttpServletRequest request) Gets theCsrfTokenRepositoryfor the specifiedHttpServletRequest.static org.springframework.security.web.context.SecurityContextRepositorygetSecurityContextRepository(javax.servlet.http.HttpServletRequest request) Gets theSecurityContextRepositoryfor the specifiedHttpServletRequest.static voidsetSecurityContextRepository(javax.servlet.http.HttpServletRequest request, org.springframework.security.web.context.SecurityContextRepository securityContextRepository) Sets theSecurityContextRepositoryfor the specifiedHttpServletRequest.
-
Method Details
-
getSecurityContextRepository
public static org.springframework.security.web.context.SecurityContextRepository getSecurityContextRepository(javax.servlet.http.HttpServletRequest request) Gets theSecurityContextRepositoryfor the specifiedHttpServletRequest. If one is not found, a defaultHttpSessionSecurityContextRepositoryis used.- Parameters:
request- theHttpServletRequestto obtain theSecurityContextRepository- Returns:
- the
SecurityContextRepositoryfor the specifiedHttpServletRequest
-
setSecurityContextRepository
public static void setSecurityContextRepository(javax.servlet.http.HttpServletRequest request, org.springframework.security.web.context.SecurityContextRepository securityContextRepository) Sets theSecurityContextRepositoryfor the specifiedHttpServletRequest.- Parameters:
request- theHttpServletRequestto obtain theSecurityContextRepositorysecurityContextRepository- theSecurityContextRepositoryto set
-
getCsrfTokenRepository
public static org.springframework.security.web.csrf.CsrfTokenRepository getCsrfTokenRepository(javax.servlet.http.HttpServletRequest request) Gets theCsrfTokenRepositoryfor the specifiedHttpServletRequest. If one is not found, the defaultHttpSessionCsrfTokenRepositoryis used.- Parameters:
request- theHttpServletRequestto obtain theCsrfTokenRepository- Returns:
- the
CsrfTokenRepositoryfor the specifiedHttpServletRequest
-