Class StandardAuthenticationHandlers

java.lang.Object
de.codecamp.vaadin.security.spring.authentication.StandardAuthenticationHandlers
All Implemented Interfaces:
RouteAccessDeniedHandler, AuthenticationResultHandler, Serializable

@Order(2147483647) public class StandardAuthenticationHandlers extends Object implements AuthenticationResultHandler, RouteAccessDeniedHandler
Provides parts of the default behavior for standard authentication.
See Also:
  • Field Details

  • Constructor Details

    • StandardAuthenticationHandlers

      public StandardAuthenticationHandlers()
  • Method Details

    • setMainRoute

      public void setMainRoute(String mainRoute)
    • setLoginRoute

      public void setLoginRoute(String loginRoute)
    • handleAuthenticationResult

      public boolean handleAuthenticationResult(AuthenticationResult result)
      Description copied from interface: AuthenticationResultHandler
      Called with the result of the authentication attempt.
      Specified by:
      handleAuthenticationResult in interface AuthenticationResultHandler
      Parameters:
      result - the authentication result
      Returns:
      whether the result should be considered handled and no further handler should be consulted; this can also prevent the default navigation after successfully logging in when on the login view
    • handleAccessDenied

      public void handleAccessDenied(com.vaadin.flow.router.BeforeEnterEvent event)
      Description copied from interface: RouteAccessDeniedHandler
      Called after a fully authenticated user has been denied access to a route.
      Specified by:
      handleAccessDenied in interface RouteAccessDeniedHandler
      Parameters:
      event - navigation event with event details while trying to access the secured route
    • storeOriginalTarget

      public static void storeOriginalTarget(com.vaadin.flow.component.UI ui, String originalTarget)
      Store the given original target in the given UI and the VaadinSession it belongs to.

      Some authentication mechanisms might require the browser to request a certain URL, which will destroy the current UI and everything stored in there. So as a fallback, the original target is also stored in the VaadinSession.

      Parameters:
      ui - the UI
      originalTarget - the original target
    • recallOriginalTarget

      public static String recallOriginalTarget(com.vaadin.flow.component.UI ui)
      Recalls (gets and removes) the original target from the given UI or the VaadinSession as a fallback.
      Parameters:
      ui - the UI
      Returns:
      originalTarget the original target or null