Class FormBaseModel
- Direct Known Subclasses:
AuthModel
,RegistrationModel
public class FormBaseModel extends WFormModel
This class manages the the auth services and the user database which an authentication model will use to implement a form..
-
Nested Class Summary
Nested classes/interfaces inherited from class eu.webtoolkit.jwt.WObject
WObject.FormData
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
LoginNameField
Login
name field. -
Constructor Summary
Constructors Constructor Description FormBaseModel(AuthService baseAuth, AbstractUserDatabase users)
Constructor.FormBaseModel(AuthService baseAuth, AbstractUserDatabase users, WObject parent)
Constructor. -
Method Summary
Modifier and Type Method Description void
addOAuth(OAuthService auth)
Adds an OAuth authentication service provider.void
addOAuth(java.util.List<OAuthService> auth)
Adds a list of OAuth authentication service providers.void
addPasswordAuth(AbstractPasswordService auth)
Adds a password authentication service.AuthService
getBaseAuth()
Returns the authentication base service.java.util.List<OAuthService>
getOAuth()
Returns the list of OAuth authentication service providers.AbstractPasswordService
getPasswordAuth()
Returns the password authentication service.AbstractUserDatabase
getUsers()
Returns the user database.WString
label(java.lang.String field)
Returns a field label.boolean
loginUser(Login login, User user)
Logs the user in.boolean
loginUser(Login login, User user, LoginState state)
Logs the user in.protected void
setValid(java.lang.String field)
protected void
setValid(java.lang.String field, java.lang.CharSequence message)
Methods inherited from class eu.webtoolkit.jwt.WFormModel
addField, addField, getFields, getValidation, getValidator, getValue, isReadOnly, isValid, isValidated, isVisible, removeField, reset, setReadOnly, setValidated, setValidation, setValidator, setValue, setVisible, validate, validateField, valueText
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
-
Field Details
-
LoginNameField
public static final java.lang.String LoginNameFieldLogin
name field.- See Also:
- Constant Field Values
-
-
Constructor Details
-
FormBaseModel
Constructor. -
FormBaseModel
Constructor.
-
-
Method Details
-
getBaseAuth
Returns the authentication base service.This returns the service passed through the constructor.
-
getUsers
Returns the user database. -
addPasswordAuth
Adds a password authentication service.This enables password-based registration, including choosing a proper password.
Only one password authentication service can be configured.
- See Also:
addOAuth(OAuthService auth)
-
getPasswordAuth
Returns the password authentication service. -
addOAuth
Adds an OAuth authentication service provider.This enables OAuth-based registration. More than one OAuth authentication service can be configured: one for each supported third-party OAuth identity provider.
-
addOAuth
Adds a list of OAuth authentication service providers.- See Also:
addOAuth(OAuthService auth)
-
getOAuth
Returns the list of OAuth authentication service providers.- See Also:
addOAuth(OAuthService auth)
-
label
Description copied from class:WFormModel
Returns a field label.The default implementation returns the WString::tr(field)
- Overrides:
label
in classWFormModel
-
loginUser
Logs the user in.Logs in the user, after checking whether the user can actually be logged in. A valid user may be refused to login if its account is disabled (see
User.getStatus()
) or if it's email address is unconfirmed and email confirmation is required.Returns whether the user could be logged in.
-
loginUser
Logs the user in. -
setValid
protected void setValid(java.lang.String field) -
setValid
protected void setValid(java.lang.String field, java.lang.CharSequence message)
-