Package io.jmix.core.security.impl
Class SystemAuthenticatorImpl
java.lang.Object
io.jmix.core.security.impl.SystemAuthenticatorSupport
io.jmix.core.security.impl.SystemAuthenticatorImpl
- All Implemented Interfaces:
SystemAuthenticator
@Component("core_SystemAuthenticator")
public class SystemAuthenticatorImpl
extends SystemAuthenticatorSupport
implements SystemAuthenticator
-
Nested Class Summary
Nested classes/interfaces inherited from class io.jmix.core.security.impl.SystemAuthenticatorSupport
SystemAuthenticatorSupport.NullAuthenticationNested classes/interfaces inherited from interface io.jmix.core.security.SystemAuthenticator
SystemAuthenticator.AuthenticatedOperation<T> -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.security.authentication.AuthenticationManagerFields inherited from class io.jmix.core.security.impl.SystemAuthenticatorSupport
NULL_AUTHENTICATION, threadLocalStack -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.springframework.security.core.Authenticationbegin()Authenticate as the 'system' user.org.springframework.security.core.AuthenticationBegins an authenticated code block.protected voidbeginServerSessionOnStartup(org.springframework.context.event.ContextRefreshedEvent event) voidend()End of an authenticated code block.protected voidendServerSessionOnStartup(org.springframework.context.event.ContextRefreshedEvent event) voidrunWithSystem(Runnable operation) Execute code as the 'system' user.voidrunWithUser(String login, Runnable operation) Execute code on behalf of the specified user.<T> TwithSystem(SystemAuthenticator.AuthenticatedOperation<T> operation) Execute code as the 'system' user and return a result.<T> TwithUser(String login, SystemAuthenticator.AuthenticatedOperation<T> operation) Execute code on behalf of the specified user and return a result.Methods inherited from class io.jmix.core.security.impl.SystemAuthenticatorSupport
pollAuthentication, pushAuthentication
-
Field Details
-
authenticationManager
@Autowired(required=false) protected org.springframework.security.authentication.AuthenticationManager authenticationManager
-
-
Constructor Details
-
SystemAuthenticatorImpl
public SystemAuthenticatorImpl()
-
-
Method Details
-
beginServerSessionOnStartup
@EventListener @Order(105) protected void beginServerSessionOnStartup(org.springframework.context.event.ContextRefreshedEvent event) -
endServerSessionOnStartup
@EventListener @Order(995) protected void endServerSessionOnStartup(org.springframework.context.event.ContextRefreshedEvent event) -
begin
Description copied from interface:SystemAuthenticatorBegins an authenticated code block.
Saves the current thread session on a stack to get it back onSystemAuthenticator.end(). SubsequentSystemAuthenticator.end()method must be called in "finally" section.- Specified by:
beginin interfaceSystemAuthenticator- Parameters:
login- user login. If null, authenticates as the 'system' user.- Returns:
- populated
Authenticationobject
-
begin
public org.springframework.security.core.Authentication begin()Description copied from interface:SystemAuthenticatorAuthenticate as the 'system' user.
Same asSystemAuthenticator.begin(String)with null parameter.- Specified by:
beginin interfaceSystemAuthenticator
-
end
public void end()Description copied from interface:SystemAuthenticatorEnd of an authenticated code block.
The previous session (or null) is set to security context. Must be called in "finally" section of a try/finally block.- Specified by:
endin interfaceSystemAuthenticator
-
withUser
public <T> T withUser(@Nullable String login, SystemAuthenticator.AuthenticatedOperation<T> operation) Description copied from interface:SystemAuthenticatorExecute code on behalf of the specified user and return a result.- Specified by:
withUserin interfaceSystemAuthenticator- Parameters:
login- user login. If null, the system session is used.operation- code to execute- Returns:
- result of the execution
-
runWithUser
Description copied from interface:SystemAuthenticatorExecute code on behalf of the specified user.- Specified by:
runWithUserin interfaceSystemAuthenticator- Parameters:
login- user login. If null, the system session is used.operation- code to execute
-
withSystem
Description copied from interface:SystemAuthenticatorExecute code as the 'system' user and return a result.- Specified by:
withSystemin interfaceSystemAuthenticator- Parameters:
operation- code to execute- Returns:
- result of the execution
-
runWithSystem
Description copied from interface:SystemAuthenticatorExecute code as the 'system' user.- Specified by:
runWithSystemin interfaceSystemAuthenticator- Parameters:
operation- code to execute
-