Class Login
public class Login extends WObject
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:
AuthWidget
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Constructor Summary
Constructors Constructor Description Login()
Default constructor. -
Method Summary
Modifier and Type Method Description Signal
changed()
Signal that indicates login changes.LoginState
getState()
Returns the current login state.User
getUser()
Returns the user currently identified.boolean
isLoggedIn()
Returns whether a user has successfully logged in.void
login(User user)
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
addChild, getId, getObjectName, remove, setFormData, setObjectName, tr
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
Login
public Login()Default constructor.Creates a login object in the LoggedOut state.
-
-
Method Details
-
login
Logs a user in.A user can be logged in using either a DisabledLogin, WeakLogin or StrongLogin
state
. The login state is forced to DisabledLogin ifUser.getStatus()
returns Disabled.- See Also:
logout()
,isLoggedIn()
-
login
Logs a user in. -
logout
public void logout()Logs the current user out.Sets the state to LoggedOut.
-
getState
Returns the current login state.- See Also:
login(User user, LoginState state)
,logout()
-
isLoggedIn
public boolean isLoggedIn()Returns whether a user has successfully logged in.This returns
true
only if the state is WeakLogin or StrongLogin.- See Also:
getState()
-
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 a DisabledLogingetState()
for example.
-