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
FieldsModifier and TypeFieldDescriptionstatic final StringTest ID for the cancel/clear button.static final StringTest ID for the login button.static final StringTest ID for the remember-me checkbox.static final StringTest ID for the password field.static final StringTest ID for the username field.Fields inherited from interface com.svenruppert.dependencies.core.logger.HasLogger
LOGGER_CACHE, WALKER -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanValidates the credentials entered by the user.voidRemoves all previously added custom elements from the login form.abstract voidCalled after successful credential validation.password()Returns the current value of the password field.abstract voidCalled when credential validation fails.voidsetCustomElements(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).username()Returns the current value of the username field.Methods inherited from class com.vaadin.flow.component.Composite
getChildren, getContent, getElement, initContentMethods 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, setVisibleMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.svenruppert.dependencies.core.logger.HasLogger
logger, loggerMethods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
BTN_LOGIN_ID
-
BTN_CANCEL_ID
-
TF_USERNAME_ID
-
PF_PASSWORD_ID
-
CB_REMEMBER_ME_ID
-
-
Constructor Details
-
LoginView
public LoginView()Assembles the login form layout.
-
-
Method Details
-
username
Returns the current value of the username field.- Returns:
- the entered username
-
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 callAuthenticationService.checkCredentials(Object)and, on success, store the subject via the configuredSubjectStore.- Returns:
trueif the credentials are valid
-