Class DelegatingSecurityContextRepository

java.lang.Object
org.springframework.security.web.context.DelegatingSecurityContextRepository
All Implemented Interfaces:
SecurityContextRepository

public final class DelegatingSecurityContextRepository extends Object implements SecurityContextRepository
A SecurityContextRepository that delegates to a list of other SecurityContextRepository instances.
Since:
5.8
  • Constructor Details

  • Method Details

    • loadContext

      @Deprecated public org.springframework.security.core.context.SecurityContext loadContext(HttpRequestResponseHolder requestResponseHolder)
      Deprecated.
      Loads the security context by delegating to each configured repository.
      Specified by:
      loadContext in interface SecurityContextRepository
      Parameters:
      requestResponseHolder - holder for the current request and response for which the context should be loaded.
      Returns:
      The security context which should be used for the current request, never null.
      See Also:
    • loadDeferredContext

      public org.springframework.security.core.context.DeferredSecurityContext loadDeferredContext(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: SecurityContextRepository
      Defers loading the SecurityContext using the HttpServletRequest until it is needed by the application.
      Specified by:
      loadDeferredContext in interface SecurityContextRepository
      Parameters:
      request - the HttpServletRequest to load the SecurityContext from
      Returns:
      a DeferredSecurityContext that returns the SecurityContext which cannot be null
    • saveContext

      public void saveContext(org.springframework.security.core.context.SecurityContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Description copied from interface: SecurityContextRepository
      Stores the security context on completion of a request.
      Specified by:
      saveContext in interface SecurityContextRepository
      Parameters:
      context - the non-null context which was obtained from the holder.
      request -
      response -
    • containsContext

      public boolean containsContext(jakarta.servlet.http.HttpServletRequest request)
      Description copied from interface: SecurityContextRepository
      Allows the repository to be queried as to whether it contains a security context for the current request.
      Specified by:
      containsContext in interface SecurityContextRepository
      Parameters:
      request - the current request
      Returns:
      true if a context is found for the request, false otherwise