Package org.zkoss.spring.init
Class SecurityContextAwareExecutionListener
java.lang.Object
org.zkoss.spring.init.SecurityContextAwareExecutionListener
- All Implemented Interfaces:
org.zkoss.zk.ui.util.ExecutionCleanup,org.zkoss.zk.ui.util.ExecutionInit
public class SecurityContextAwareExecutionListener
extends Object
implements org.zkoss.zk.ui.util.ExecutionInit, org.zkoss.zk.ui.util.ExecutionCleanup
ZK Listener to fill/cleanup Springs
This implementation will retrieve the current
The listener can be enabled/disabled via the library property 'org.zkoss.spring.init.SecurityContextAwareExecutionListener.enabled'.
After disabling a custom implementation can be provided e.g. by overriding the
SecurityContextHolder for executions outside Spring's security filter chain.
e.g. Websocket requests or executions activated from background threads (server push / eventqueues / manual activation).This implementation will retrieve the current
SecurityContext stored in the Http Session using Spring's
default attribute name HttpSessionSecurityContextRepository.SPRING_SECURITY_CONTEXT_KEYThe listener can be enabled/disabled via the library property 'org.zkoss.spring.init.SecurityContextAwareExecutionListener.enabled'.
After disabling a custom implementation can be provided e.g. by overriding the
loadSecurityContext(Execution) method.- Since:
- 4.0.0
- Author:
- Robert
- See Also:
-
ExecutionInitExecutionCleanupSecurityWebAppInit.SECURITY_CONTEXT_AWARE_EXECUTION_LISTENER_ENABLED
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidinit(org.zkoss.zk.ui.Execution exec, org.zkoss.zk.ui.Execution parent) protected org.springframework.security.core.context.SecurityContextloadSecurityContext(org.zkoss.zk.ui.Execution execution) Retrieve the currentSecurityContextfrom the session associated with the given execution
-
Constructor Details
-
SecurityContextAwareExecutionListener
public SecurityContextAwareExecutionListener()
-
-
Method Details
-
init
- Specified by:
initin interfaceorg.zkoss.zk.ui.util.ExecutionInit- Throws:
Exception
-
cleanup
public void cleanup(org.zkoss.zk.ui.Execution exec, org.zkoss.zk.ui.Execution parent, List<Throwable> errs) throws Exception - Specified by:
cleanupin interfaceorg.zkoss.zk.ui.util.ExecutionCleanup- Throws:
Exception
-
loadSecurityContext
protected org.springframework.security.core.context.SecurityContext loadSecurityContext(org.zkoss.zk.ui.Execution execution) Retrieve the currentSecurityContextfrom the session associated with the given execution- Parameters:
execution- the current execution- Returns:
- a SecurityContext or null
-