Class Login
This is a model class which is typically associated with a single session, for the duration of the session.
Widgets that implement authentication (and thus produce authentication changes), will indicate
their result in this object using the login()
or
logout()
methods.
Widgets that want to react to login state changes (typically, as user logging in or out)
should listen to the changed()
signal of this object.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionchanged()
Signal that indicates login changes.getState()
Returns the current login state.getUser()
Returns the user currently identified.boolean
Returns whether a user has successfully logged in.final void
Logs a user in.void
login
(User user, LoginState state) Logs a user in.void
logout()
Logs the current user out.Methods inherited from class eu.webtoolkit.jwt.WObject
getId, getObjectName, remove, setFormData, setObjectName, tr
-
Constructor Details
-
Login
public Login()Default constructor.Creates a login object in the
LoginState.LoggedOut
state.
-
-
Method Details
-
login
Logs a user in.A user can be logged in using either a
LoginState.Disabled
,LoginState.Weak
orLoginState.Strong
state
. The login state is forced toLoginState.Disabled
ifUser.getStatus()
returns Disabled.- See Also:
-
login
Logs a user in. -
logout
public void logout()Logs the current user out.Sets the state to
LoginState.LoggedOut
. -
getState
Returns the current login state.- See Also:
-
isLoggedIn
public boolean isLoggedIn()Returns whether a user has successfully logged in.This returns
true
only if the state isLoginState.Weak
orLoginState.Strong
.- See Also:
-
getUser
Returns the user currently identified.Returns the user currently identified.
Note: This may also be a user whose account is currently disabled.
-
changed
Signal that indicates login changes.This signal is emitted as a result of
login()
orlogout()
. If no user was logged in, then achanged()
signal does not necessarily mean that user isisLoggedIn()
as the user may have been identified correctly but have aLoginState.Disabled
getState()
for example.
-