Package io.jmix.flowui.sys
Class JmixSecurityContextHolderStrategy
java.lang.Object
io.jmix.flowui.sys.JmixSecurityContextHolderStrategy
- All Implemented Interfaces:
ThreadSecurityContextOverride,org.springframework.security.core.context.SecurityContextHolderStrategy
@NullMarked
public class JmixSecurityContextHolderStrategy
extends Object
implements org.springframework.security.core.context.SecurityContextHolderStrategy, ThreadSecurityContextOverride
SecurityContextHolderStrategy for FlowUI applications.
Delegates to Vaadin's VaadinAwareSecurityContextHolderStrategy, which prefers the security context stored
in the current Vaadin session over the thread-local one. On top of that, it lets SystemAuthenticator
install a context that takes precedence for the current thread only, so that begin()/end() take
effect on UI threads and never modify the context shared by all threads of the HTTP session.
setContext(SecurityContext) replaces the context within the current override, preserving the enclosing
scopes. clearContext() drops all overrides when a request or task releases its thread.
-
Constructor Summary
ConstructorsConstructorDescriptionJmixSecurityContextHolderStrategy(org.springframework.security.core.context.SecurityContextHolderStrategy delegate) -
Method Summary
Modifier and TypeMethodDescriptionvoidorg.springframework.security.core.context.SecurityContextorg.springframework.security.core.context.SecurityContextSupplier<org.springframework.security.core.context.SecurityContext> voidRemoves the most recently pushed override from the current thread.voidpushContext(org.springframework.security.core.context.SecurityContext context) Makes the given context the one returned bygetContext()on the current thread until a matchingThreadSecurityContextOverride.popContext()call.voidsetContext(org.springframework.security.core.context.SecurityContext context) voidsetDeferredContext(Supplier<org.springframework.security.core.context.SecurityContext> deferredContext)
-
Constructor Details
-
JmixSecurityContextHolderStrategy
public JmixSecurityContextHolderStrategy() -
JmixSecurityContextHolderStrategy
public JmixSecurityContextHolderStrategy(org.springframework.security.core.context.SecurityContextHolderStrategy delegate)
-
-
Method Details
-
getContext
public org.springframework.security.core.context.SecurityContext getContext()- Specified by:
getContextin interfaceorg.springframework.security.core.context.SecurityContextHolderStrategy
-
getDeferredContext
- Specified by:
getDeferredContextin interfaceorg.springframework.security.core.context.SecurityContextHolderStrategy
-
setContext
public void setContext(org.springframework.security.core.context.SecurityContext context) - Specified by:
setContextin interfaceorg.springframework.security.core.context.SecurityContextHolderStrategy
-
setDeferredContext
public void setDeferredContext(Supplier<org.springframework.security.core.context.SecurityContext> deferredContext) - Specified by:
setDeferredContextin interfaceorg.springframework.security.core.context.SecurityContextHolderStrategy
-
clearContext
public void clearContext()- Specified by:
clearContextin interfaceorg.springframework.security.core.context.SecurityContextHolderStrategy
-
createEmptyContext
public org.springframework.security.core.context.SecurityContext createEmptyContext()- Specified by:
createEmptyContextin interfaceorg.springframework.security.core.context.SecurityContextHolderStrategy
-
pushContext
public void pushContext(org.springframework.security.core.context.SecurityContext context) Description copied from interface:ThreadSecurityContextOverrideMakes the given context the one returned bygetContext()on the current thread until a matchingThreadSecurityContextOverride.popContext()call.- Specified by:
pushContextin interfaceThreadSecurityContextOverride
-
popContext
public void popContext()Description copied from interface:ThreadSecurityContextOverrideRemoves the most recently pushed override from the current thread. Does nothing if there is no override.- Specified by:
popContextin interfaceThreadSecurityContextOverride
-