Class LoginViewSupport

java.lang.Object
io.jmix.securityflowui.authentication.LoginViewSupport

@SpringComponent("flowui_LoginViewSupport") public class LoginViewSupport extends Object
Class that provides authentication via AuthenticationManager. It is intended to use from login view.

Example usage:

 @Autowired
 private LoginViewSupport authenticator;

 private void doLogin(String username, String password) {
     loginViewSupport.authenticate(
         AuthDetails.of(event.getUsername(), event.getPassword())
     );
 }
 
See Also:
  • Field Details

    • authenticationManager

      protected org.springframework.security.authentication.AuthenticationManager authenticationManager
    • coreProperties

      protected CoreProperties coreProperties
    • uiProperties

      protected UiProperties uiProperties
    • viewNavigators

      protected ViewNavigators viewNavigators
    • accessManager

      protected AccessManager accessManager
    • messages

      protected Messages messages
    • clientDetailsProvider

      protected ExtendedClientDetailsProvider clientDetailsProvider
    • rememberMeServices

      protected org.springframework.security.web.authentication.RememberMeServices rememberMeServices
    • applicationEventPublisher

      protected org.springframework.context.ApplicationEventPublisher applicationEventPublisher
    • requestCache

      protected com.vaadin.flow.spring.security.VaadinDefaultRequestCache requestCache
    • viewRegistry

      protected ViewRegistry viewRegistry
    • cookies

      protected AppCookies cookies
  • Constructor Details

    • LoginViewSupport

      public LoginViewSupport()
  • Method Details

    • setAuthenticationManager

      @Autowired public void setAuthenticationManager(org.springframework.security.authentication.AuthenticationManager authenticationManager)
    • setCoreProperties

      @Autowired public void setCoreProperties(CoreProperties coreProperties)
    • setUiProperties

      @Autowired public void setUiProperties(UiProperties uiProperties)
    • setViewNavigators

      @Autowired public void setViewNavigators(ViewNavigators viewNavigators)
    • setAccessManager

      @Autowired public void setAccessManager(AccessManager accessManager)
    • setMessages

      @Autowired public void setMessages(Messages messages)
    • setRememberMeServices

      @Autowired public void setRememberMeServices(org.springframework.security.web.authentication.RememberMeServices rememberMeServices)
    • setApplicationEventPublisher

      @Autowired public void setApplicationEventPublisher(org.springframework.context.ApplicationEventPublisher applicationEventPublisher)
    • setRequestCache

      @Autowired public void setRequestCache(com.vaadin.flow.spring.security.VaadinDefaultRequestCache requestCache)
    • setClientDetailsProvider

      @Autowired public void setClientDetailsProvider(ExtendedClientDetailsProvider clientDetailsProvider)
    • setAuthenticationStrategy

      @Autowired(required=false) public void setAuthenticationStrategy(org.springframework.security.web.authentication.session.SessionAuthenticationStrategy authenticationStrategy)
    • setViewRegistry

      @Autowired public void setViewRegistry(ViewRegistry viewRegistry)
    • authenticate

      public org.springframework.security.core.Authentication authenticate(AuthDetails authDetails) throws org.springframework.security.core.AuthenticationException
      Performs authentication via AuthenticationManager and uses UsernamePasswordAuthenticationToken with credentials from AuthDetails.

      If locale is not provided it will use the first locale from CoreProperties.getAvailableLocales() list.

      After successful authentication, there will be an attempt to open the main view.

      Parameters:
      authDetails - authentication details
      Returns:
      a fully authenticated object including credentials
      Throws:
      org.springframework.security.core.AuthenticationException - if exception occurs while authentication process
    • preventSessionFixation

      protected void preventSessionFixation(org.springframework.security.core.Authentication authentication)
    • onSuccessfulAuthentication

      protected void onSuccessfulAuthentication(org.springframework.security.core.Authentication authentication, AuthDetails authDetails)
    • saveCookies

      protected void saveCookies(AuthDetails authDetails)
    • checkLoginToUi

      protected void checkLoginToUi(AuthDetails authDetails, org.springframework.security.core.Authentication authentication)
    • showInitialView

      protected void showInitialView(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response)
    • getRedirectLocation

      @Nullable protected com.vaadin.flow.router.Location getRedirectLocation(com.vaadin.flow.server.VaadinServletRequest request, com.vaadin.flow.server.VaadinServletResponse response)
    • isRedirectToInitialView

      protected boolean isRedirectToInitialView(com.vaadin.flow.router.Location redirectLocation)
    • getEntityClass

      protected Class<?> getEntityClass(ViewInfo viewInfo)
    • createAuthenticationToken

      protected org.springframework.security.core.Authentication createAuthenticationToken(String username, String password, @Nullable Locale locale, @Nullable TimeZone timeZone)
    • getDefaultLocale

      protected Locale getDefaultLocale()
    • getDeviceTimeZone

      @Nullable protected TimeZone getDeviceTimeZone()
    • detectTimeZone

      protected TimeZone detectTimeZone(com.vaadin.flow.component.page.ExtendedClientDetails details)
    • getCookies

      protected AppCookies getCookies()