Wt
4.11.1
|
A base model class for authentication-related forms. More...
#include <Wt/Auth/FormBaseModel.h>
Public Member Functions | |
FormBaseModel (const AuthService &baseAuth, AbstractUserDatabase &users) | |
Constructor. | |
const AuthService * | baseAuth () const |
Returns the authentication base service. More... | |
AbstractUserDatabase & | users () |
Returns the user database. | |
const AbstractUserDatabase & | users () const |
Returns the user database. | |
virtual void | addPasswordAuth (const AbstractPasswordService *auth) |
Adds a password authentication service. More... | |
const AbstractPasswordService * | passwordAuth () const |
Returns the password authentication service. More... | |
virtual void | addOAuth (const OAuthService *auth) |
Adds an OAuth authentication service provider. More... | |
virtual void | addOAuth (const std::vector< const OAuthService * > &auth) |
Adds a list of OAuth authentication service providers. More... | |
std::vector< const OAuthService * > | oAuth () const |
Returns the list of OAuth authentication service providers. More... | |
virtual void | addSaml (const Saml::Service *auth) |
Adds a SAML authentication service provider. | |
virtual void | addSaml (const std::vector< const Saml::Service * > &auth) |
Adds a list of SAML authentication service providers. More... | |
std::vector< const Saml::Service * > | saml () const |
Returns the list of SAML authentication service providers. More... | |
virtual WString | label (Field field) const override |
Returns a field label. More... | |
virtual bool | loginUser (Login &login, User &user, LoginState state=LoginState::Strong) |
Logs the user in. More... | |
Public Member Functions inherited from Wt::WFormModel | |
WFormModel () | |
Constructor. More... | |
void | addField (Field field, const WString &info=WString::Empty) |
Adds a field. More... | |
void | removeField (Field field) |
Removes a field. More... | |
std::vector< Field > | fields () const |
Returns the fields. More... | |
virtual void | reset () |
Resets the model. More... | |
virtual bool | validate () |
Validates the current input. More... | |
bool | valid () const |
Returns the current overall validation state. More... | |
void | setVisible (Field field, bool visible) |
Sets whether a field is visible. More... | |
virtual bool | isVisible (Field field) const |
Returns whether a field is visible. More... | |
void | setReadOnly (Field field, bool readOnly) |
Sets whether a field is read-only. More... | |
virtual bool | isReadOnly (Field field) const |
Returns whether a field is read only. More... | |
virtual void | setValue (Field field, const cpp17::any &value) |
Sets the field value. More... | |
virtual const cpp17::any & | value (Field field) const |
Returns the field value. More... | |
virtual WString | valueText (Field field) const |
Returns the field value text. More... | |
virtual void | setValidator (Field field, const std::shared_ptr< WValidator > &validator) |
Sets a validator. | |
virtual std::shared_ptr< WValidator > | validator (Field field) const |
Returns a validator. More... | |
virtual bool | validateField (Field field) |
Validates a field. More... | |
virtual void | setValidated (Field field, bool validated) |
Sets whether a field has been validated. More... | |
virtual bool | isValidated (Field field) const |
Returns whether the field has been validated yet. More... | |
const WValidator::Result & | validation (Field field) const |
Returns the result of a validation. More... | |
virtual void | setValidation (Field field, const WValidator::Result &result) |
Sets the validation result for a field. More... | |
Public Member Functions inherited from Wt::WObject | |
void | addChild (std::unique_ptr< WObject > child) |
Add a child WObject whose lifetime is determined by this WObject. | |
template<typename Child > | |
Child * | addChild (std::unique_ptr< Child > child) |
Add a child WObject, returning a raw pointer. More... | |
std::unique_ptr< WObject > | removeChild (WObject *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. | |
template<typename Child > | |
std::unique_ptr< Child > | removeChild (Child *child) |
Remove a child WObject, so its lifetime is no longer determined by this WObject. More... | |
virtual const std::string | id () const |
Returns the (unique) identifier for this object. More... | |
virtual void | setObjectName (const std::string &name) |
Sets an object name. More... | |
virtual std::string | objectName () const |
Returns the object name. More... | |
void | resetLearnedSlots () |
Resets learned stateless slot implementations. More... | |
template<class T > | |
void | resetLearnedSlot (void(T::*method)()) |
Resets a learned stateless slot implementation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)()) |
Declares a slot to be stateless and learn client-side behaviour on first invocation. More... | |
template<class T > | |
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)()) |
Declares a slot to be stateless and learn client-side behaviour in advance. More... | |
void | isNotStateless () |
Marks the current function as not stateless. More... | |
template<class T > | |
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode) |
Provides a JavaScript implementation for a method. More... | |
Public Member Functions inherited from Wt::Core::observable | |
observable () noexcept | |
Default constructor. | |
virtual | ~observable () |
Destructor. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...)) noexcept |
Protects a method call against object destruction. More... | |
template<typename... Args, typename C > | |
auto | bindSafe (void(C::*method)(Args...) const) const noexcept |
Protects a const method call against object destruction. More... | |
template<typename Function > | |
auto | bindSafe (const Function &function) noexcept |
Protects a function against object destruction. More... | |
Static Public Attributes | |
static const Field | LoginNameField = "user-name" |
Login name field. | |
Additional Inherited Members | |
Public Types inherited from Wt::WFormModel | |
typedef const char * | Field |
A type to identify a field. More... | |
Public Types inherited from Wt::WObject | |
typedef void(WObject::* | Method) () |
Typedef for a WObject method without arguments. | |
Protected Member Functions inherited from Wt::WObject | |
virtual WStatelessSlot * | getStateless (Method method) |
On-demand stateless slot implementation. More... | |
A base model class for authentication-related forms.
This class manages the the auth services and the user database which an authentication model will use to implement a form..
|
virtual |
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.
|
virtual |
Adds a list of OAuth authentication service providers.
|
virtual |
Adds a password authentication service.
This enables password-based registration, including choosing a proper password.
Only one password authentication service can be configured.
|
virtual |
Adds a list of SAML authentication service providers.
const AuthService* Wt::Auth::FormBaseModel::baseAuth | ( | ) | const |
Returns the authentication base service.
This returns the service passed through the constructor.
Returns a field label.
The default implementation returns the WString::tr(field)
Reimplemented from Wt::WFormModel.
|
virtual |
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::status()) or if it's email address is unconfirmed and email confirmation is required.
Returns whether the user could be logged in.
std::vector<const OAuthService *> Wt::Auth::FormBaseModel::oAuth | ( | ) | const |
Returns the list of OAuth authentication service providers.
const AbstractPasswordService* Wt::Auth::FormBaseModel::passwordAuth | ( | ) | const |
Returns the password authentication service.
std::vector<const Saml::Service *> Wt::Auth::FormBaseModel::saml | ( | ) | const |
Returns the list of SAML authentication service providers.