Class WebTestUtils
- java.lang.Object
-
- org.springframework.security.test.web.support.WebTestUtils
-
public abstract class WebTestUtils extends Object
A utility class for testing spring security- Since:
- 4.0
- Author:
- Rob Winch
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.springframework.security.web.csrf.CsrfTokenRepository
getCsrfTokenRepository(javax.servlet.http.HttpServletRequest request)
Gets theCsrfTokenRepository
for the specifiedHttpServletRequest
.static org.springframework.security.web.context.SecurityContextRepository
getSecurityContextRepository(javax.servlet.http.HttpServletRequest request)
Gets theSecurityContextRepository
for the specifiedHttpServletRequest
.static void
setSecurityContextRepository(javax.servlet.http.HttpServletRequest request, org.springframework.security.web.context.SecurityContextRepository securityContextRepository)
Sets theSecurityContextRepository
for the specifiedHttpServletRequest
.
-
-
-
Method Detail
-
getSecurityContextRepository
public static org.springframework.security.web.context.SecurityContextRepository getSecurityContextRepository(javax.servlet.http.HttpServletRequest request)
Gets theSecurityContextRepository
for the specifiedHttpServletRequest
. If one is not found, a defaultHttpSessionSecurityContextRepository
is used.- Parameters:
request
- theHttpServletRequest
to obtain theSecurityContextRepository
- Returns:
- the
SecurityContextRepository
for the specifiedHttpServletRequest
-
setSecurityContextRepository
public static void setSecurityContextRepository(javax.servlet.http.HttpServletRequest request, org.springframework.security.web.context.SecurityContextRepository securityContextRepository)
Sets theSecurityContextRepository
for the specifiedHttpServletRequest
.- Parameters:
request
- theHttpServletRequest
to obtain theSecurityContextRepository
securityContextRepository
- theSecurityContextRepository
to set
-
getCsrfTokenRepository
public static org.springframework.security.web.csrf.CsrfTokenRepository getCsrfTokenRepository(javax.servlet.http.HttpServletRequest request)
Gets theCsrfTokenRepository
for the specifiedHttpServletRequest
. If one is not found, the defaultHttpSessionCsrfTokenRepository
is used.- Parameters:
request
- theHttpServletRequest
to obtain theCsrfTokenRepository
- Returns:
- the
CsrfTokenRepository
for the specifiedHttpServletRequest
-
-