Wt  3.7.1
Public Member Functions | Static Public Attributes | List of all members
Wt::Auth::FormBaseModel Class Reference

A base model class for authentication-related forms. More...

#include <Wt/Auth/FormBaseModel>

Inheritance diagram for Wt::Auth::FormBaseModel:
Inheritance graph
[legend]

Public Member Functions

 FormBaseModel (const AuthService &baseAuth, AbstractUserDatabase &users, WObject *parent=0)
 Constructor.
 
const AuthServicebaseAuth () const
 Returns the authentication base service. More...
 
AbstractUserDatabaseusers ()
 Returns the user database.
 
virtual void addPasswordAuth (const AbstractPasswordService *auth)
 Adds a password authentication service. More...
 
const AbstractPasswordServicepasswordAuth () 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 WString label (Field field) const
 Returns a field label. More...
 
virtual bool loginUser (Login &login, User &user, LoginState state=StrongLogin)
 Logs the user in. More...
 
- Public Member Functions inherited from Wt::WFormModel
 WFormModel (WObject *parent=0)
 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< Fieldfields () 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 boost::any &value)
 Sets the field value. More...
 
virtual const boost::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, WValidator *validator)
 Sets a validator. More...
 
virtual WValidatorvalidator (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::Resultvalidation (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
 WObject (WObject *parent=0)
 Create a WObject with a given parent object. More...
 
virtual ~WObject ()
 Destructor. 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...
 
void addChild (WObject *child)
 Adds a child object. More...
 
virtual void removeChild (WObject *child)
 Removes a child object. More...
 
const std::vector< WObject * > & children () const
 Returns the children.
 
WObjectparent () const
 Returns the parent object.
 

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...
 
- Static Protected Member Functions inherited from Wt::WObject
static WObjectsender ()
 Returns the sender of the current slot call. More...
 

Detailed Description

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..

Member Function Documentation

◆ addOAuth() [1/2]

void Wt::Auth::FormBaseModel::addOAuth ( const OAuthService auth)
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.

See also
addPasswordAuth()

◆ addOAuth() [2/2]

void Wt::Auth::FormBaseModel::addOAuth ( const std::vector< const OAuthService *> &  auth)
virtual

Adds a list of OAuth authentication service providers.

See also
addOAuth()

◆ addPasswordAuth()

void Wt::Auth::FormBaseModel::addPasswordAuth ( const AbstractPasswordService auth)
virtual

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()
AbstractPasswordService::validatePassword()

◆ baseAuth()

const AuthService* Wt::Auth::FormBaseModel::baseAuth ( ) const

Returns the authentication base service.

This returns the service passed through the constructor.

◆ label()

WString Wt::Auth::FormBaseModel::label ( Field  field) const
virtual

Returns a field label.

The default implementation returns the WString::tr(field)

Reimplemented from Wt::WFormModel.

◆ loginUser()

bool Wt::Auth::FormBaseModel::loginUser ( Login login,
User user,
LoginState  state = StrongLogin 
)
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.

◆ oAuth()

std::vector<const OAuthService *> Wt::Auth::FormBaseModel::oAuth ( ) const

Returns the list of OAuth authentication service providers.

See also
addOAuth()

◆ passwordAuth()

const AbstractPasswordService* Wt::Auth::FormBaseModel::passwordAuth ( ) const

Returns the password authentication service.

See also
addPasswordAuth()

Generated on Tue Dec 15 2020 for the C++ Web Toolkit (Wt) by doxygen 1.8.13