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

    Modifier and Type
    Method
    Description
    static org.springframework.security.web.csrf.CsrfTokenRepository
    getCsrfTokenRepository(javax.servlet.http.HttpServletRequest request)
    Gets the CsrfTokenRepository for the specified HttpServletRequest.
    static org.springframework.security.web.context.SecurityContextRepository
    getSecurityContextRepository(javax.servlet.http.HttpServletRequest request)
    Gets the SecurityContextRepository for the specified HttpServletRequest.
    static void
    setSecurityContextRepository(javax.servlet.http.HttpServletRequest request, org.springframework.security.web.context.SecurityContextRepository securityContextRepository)
    Sets the SecurityContextRepository for the specified HttpServletRequest.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getSecurityContextRepository

      public static org.springframework.security.web.context.SecurityContextRepository getSecurityContextRepository(javax.servlet.http.HttpServletRequest request)
      Gets the SecurityContextRepository for the specified HttpServletRequest. If one is not found, a default HttpSessionSecurityContextRepository is used.
      Parameters:
      request - the HttpServletRequest to obtain the SecurityContextRepository
      Returns:
      the SecurityContextRepository for the specified HttpServletRequest
    • setSecurityContextRepository

      public static void setSecurityContextRepository(javax.servlet.http.HttpServletRequest request, org.springframework.security.web.context.SecurityContextRepository securityContextRepository)
      Sets the SecurityContextRepository for the specified HttpServletRequest.
      Parameters:
      request - the HttpServletRequest to obtain the SecurityContextRepository
      securityContextRepository - the SecurityContextRepository to set
    • getCsrfTokenRepository

      public static org.springframework.security.web.csrf.CsrfTokenRepository getCsrfTokenRepository(javax.servlet.http.HttpServletRequest request)
      Gets the CsrfTokenRepository for the specified HttpServletRequest. If one is not found, the default HttpSessionCsrfTokenRepository is used.
      Parameters:
      request - the HttpServletRequest to obtain the CsrfTokenRepository
      Returns:
      the CsrfTokenRepository for the specified HttpServletRequest