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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancontainsContext(jakarta.servlet.http.HttpServletRequest request) Allows the repository to be queried as to whether it contains a security context for the current request.loadContext(HttpRequestResponseHolder requestResponseHolder) Deprecated.loadDeferredContext(jakarta.servlet.http.HttpServletRequest request) Defers loading theSecurityContextusing theHttpServletRequestuntil it is needed by the application.voidsaveContext(SecurityContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Stores the security context on completion of a request.
-
Constructor Details
-
DelegatingSecurityContextRepository
-
DelegatingSecurityContextRepository
-
-
Method Details
-
loadContext
Deprecated.Loads the security context by delegating to each configured repository.- Specified by:
loadContextin interfaceSecurityContextRepository- 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
Description copied from interface:SecurityContextRepositoryDefers loading theSecurityContextusing theHttpServletRequestuntil it is needed by the application.- Specified by:
loadDeferredContextin interfaceSecurityContextRepository- Parameters:
request- theHttpServletRequestto load theSecurityContextfrom- Returns:
- a
DeferredSecurityContextthat returns theSecurityContextwhich cannot be null
-
saveContext
public void saveContext(SecurityContext context, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) Description copied from interface:SecurityContextRepositoryStores the security context on completion of a request.- Specified by:
saveContextin interfaceSecurityContextRepository- 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:SecurityContextRepositoryAllows the repository to be queried as to whether it contains a security context for the current request.- Specified by:
containsContextin interfaceSecurityContextRepository- Parameters:
request- the current request- Returns:
- true if a context is found for the request, false otherwise
-