Wt  4.0.2
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.h>

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

Public Member Functions

 FormBaseModel (const AuthService &baseAuth, AbstractUserDatabase &users)
 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 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< 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 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< 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
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< WObjectremoveChild (WObject *child)
 Remove a child WObject, so its lifetime is no longer determined by this WObject.
 
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...
 

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

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

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()
void Wt::Auth::FormBaseModel::addOAuth ( const std::vector< const OAuthService * > &  auth)
virtual

Adds a list of OAuth authentication service providers.

See also
addOAuth()
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()
const AuthService* Wt::Auth::FormBaseModel::baseAuth ( ) const

Returns the authentication base service.

This returns the service passed through the constructor.

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

Returns a field label.

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

Reimplemented from Wt::WFormModel.

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

See also
addOAuth()
const AbstractPasswordService* Wt::Auth::FormBaseModel::passwordAuth ( ) const

Returns the password authentication service.

See also
addPasswordAuth()

Generated on Fri Nov 24 2017 for the C++ Web Toolkit (Wt) by doxygen 1.8.11