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
  • 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

      public org.springframework.security.core.Authentication begin(@Nullable String login)
      Description copied from interface: SystemAuthenticator
      Begins an authenticated code block.
      Saves the current thread session on a stack to get it back on SystemAuthenticator.end(). Subsequent SystemAuthenticator.end() method must be called in "finally" section.
      Specified by:
      begin in interface SystemAuthenticator
      Parameters:
      login - user login. If null, authenticates as the 'system' user.
      Returns:
      populated Authentication object
    • begin

      public org.springframework.security.core.Authentication begin()
      Description copied from interface: SystemAuthenticator
      Authenticate as the 'system' user.
      Same as SystemAuthenticator.begin(String) with null parameter.
      Specified by:
      begin in interface SystemAuthenticator
    • end

      public void end()
      Description copied from interface: SystemAuthenticator
      End 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:
      end in interface SystemAuthenticator
    • withUser

      public <T> T withUser(@Nullable String login, SystemAuthenticator.AuthenticatedOperation<T> operation)
      Description copied from interface: SystemAuthenticator
      Execute code on behalf of the specified user and return a result.
      Specified by:
      withUser in interface SystemAuthenticator
      Parameters:
      login - user login. If null, the system session is used.
      operation - code to execute
      Returns:
      result of the execution
    • runWithUser

      public void runWithUser(@Nullable String login, Runnable operation)
      Description copied from interface: SystemAuthenticator
      Execute code on behalf of the specified user.
      Specified by:
      runWithUser in interface SystemAuthenticator
      Parameters:
      login - user login. If null, the system session is used.
      operation - code to execute
    • withSystem

      public <T> T withSystem(SystemAuthenticator.AuthenticatedOperation<T> operation)
      Description copied from interface: SystemAuthenticator
      Execute code as the 'system' user and return a result.
      Specified by:
      withSystem in interface SystemAuthenticator
      Parameters:
      operation - code to execute
      Returns:
      result of the execution
    • runWithSystem

      public void runWithSystem(Runnable operation)
      Description copied from interface: SystemAuthenticator
      Execute code as the 'system' user.
      Specified by:
      runWithSystem in interface SystemAuthenticator
      Parameters:
      operation - code to execute