Class LoginView

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.HorizontalLayout>
com.svenruppert.jsentinel.authorization.LoginView
All Implemented Interfaces:
com.svenruppert.dependencies.core.logger.HasLogger, com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, Serializable

public abstract class LoginView extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.HorizontalLayout> implements com.svenruppert.dependencies.core.logger.HasLogger
Abstract base class for login views.

Provides a pre-built login form with username, password, remember-me checkbox, and sign-in / clear buttons. Subclasses implement the three abstract methods to wire credential checking, navigation after login, and error handling.

The form can be extended with custom UI elements via setCustomElements(Component).

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    Test ID for the cancel/clear button.
    static final String
    Test ID for the login button.
    static final String
    Test ID for the remember-me checkbox.
    static final String
    Test ID for the password field.
    static final String
    Test ID for the username field.

    Fields inherited from interface com.svenruppert.dependencies.core.logger.HasLogger

    LOGGER_CACHE, WALKER
  • Constructor Summary

    Constructors
    Constructor
    Description
    Assembles the login form layout.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract boolean
    Validates the credentials entered by the user.
    void
    Removes all previously added custom elements from the login form.
    abstract void
    Called after successful credential validation.
    Returns the current value of the password field.
    abstract void
    Called when credential validation fails.
    void
    setCustomElements(com.vaadin.flow.component.Component component)
    Adds a custom UI component to the login form (below the password field and above the remember-me checkbox).
    Returns the current value of the username field.

    Methods inherited from class com.vaadin.flow.component.Composite

    getChildren, getContent, getElement, initContent

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, bindVisible, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.svenruppert.dependencies.core.logger.HasLogger

    logger, logger

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Field Details

  • Constructor Details

    • LoginView

      public LoginView()
      Assembles the login form layout.
  • Method Details

    • username

      public String username()
      Returns the current value of the username field.
      Returns:
      the entered username
    • password

      public String password()
      Returns the current value of the password field.
      Returns:
      the entered password
    • setCustomElements

      public void setCustomElements(com.vaadin.flow.component.Component component)
      Adds a custom UI component to the login form (below the password field and above the remember-me checkbox).
      Parameters:
      component - the component to add
    • clearCustomElements

      public void clearCustomElements()
      Removes all previously added custom elements from the login form.
    • reactOnFailedLogin

      public abstract void reactOnFailedLogin()
      Called when credential validation fails. Implementations typically show a notification or close the session.
    • checkCredentials

      public abstract boolean checkCredentials()
      Validates the credentials entered by the user. Implementations should call AuthenticationService.checkCredentials(Object) and, on success, store the subject via the configured SubjectStore.
      Returns:
      true if the credentials are valid