Wt: Wt::Auth::FormBaseModel Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
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:
[legend]

## Public Member Functions
| FormBaseModel (const AuthService &baseAuth, AbstractUserDatabase &users)
| Constructor.
const AuthService * | baseAuth () const
| Returns the authentication base service.
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.
const AbstractPasswordService * | passwordAuth () const
| Returns the password authentication service.
virtual void | addOAuth (const OAuthService *auth)
| Adds an OAuth authentication service provider.
virtual void | addOAuth (const std::vector< const OAuthService * > &auth)
| Adds a list of OAuth authentication service providers.
std::vector< const OAuthService * > | oAuth () const
| Returns the list of OAuth authentication service providers.
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.
std::vector< const Saml::Service * > | saml () const
| Returns the list of SAML authentication service providers.
virtual WString | label (Field field) const override
| Returns a field label.
virtual bool | loginUser (Login &login, User &user, LoginState state=LoginState::Strong)
| Logs the user in.
Public Member Functions inherited from Wt::WFormModel
| WFormModel ()
| Constructor.
void | addField (Field field, const WString &info=WString::Empty)
| Adds a field.
void | removeField (Field field)
| Removes a field.
std::vector< Field > | fields () const
| Returns the fields.
virtual void | reset ()
| Resets the model.
virtual bool | validate ()
| Validates the current input.
bool | valid () const
| Returns the current overall validation state.
void | setVisible (Field field, bool visible)
| Sets whether a field is visible.
virtual bool | isVisible (Field field) const
| Returns whether a field is visible.
void | setReadOnly (Field field, bool readOnly)
| Sets whether a field is read-only.
virtual bool | isReadOnly (Field field) const
| Returns whether a field is read only.
virtual void | setValue (Field field, const cpp17::any &value)
| Sets the field value.
virtual const cpp17::any & | value (Field field) const
| Returns the field value.
virtual WString | valueText (Field field) const
| Returns the field value text.
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.
virtual bool | validateField (Field field)
| Validates a field.
virtual void | setValidated (Field field, bool validated)
| Sets whether a field has been validated.
virtual bool | isValidated (Field field) const
| Returns whether the field has been validated yet.
const WValidator::Result & | validation (Field field) const
| Returns the result of a validation.
virtual void | setValidation (Field field, const WValidator::Result &result)
| Sets the validation result for a field.
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.
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.
virtual const std::string | id () const
| Returns the (unique) identifier for this object.
virtual void | setObjectName (const std::string &name)
| Sets an object name.
virtual std::string | objectName () const
| Returns the object name.
void | resetLearnedSlots ()
| Resets learned stateless slot implementations.
template<class T >
void | resetLearnedSlot (void(T::*method)())
| Resets a learned stateless slot implementation.
template<class T >
WStatelessSlot * | implementStateless (void(T::*method)())
| Declares a slot to be stateless and learn client-side behaviour on first invocation.
template<class T >
WStatelessSlot * | implementStateless (void(T::*method)(), void(T::*undoMethod)())
| Declares a slot to be stateless and learn client-side behaviour in advance.
void | isNotStateless ()
| Marks the current function as not stateless.
template<class T >
WStatelessSlot * | implementJavaScript (void(T::*method)(), const std::string &jsCode)
| Provides a JavaScript implementation for a method.
Public Member Functions inherited from Wt::Core::observable
| observable () noexcept
| Default constructor.
virtual | ~observable ()
| Destructor.
template<typename... Args, typename C >
auto | bindSafe (void(C::*method)(Args...)) noexcept
| Protects a method call against object destruction.
template<typename... Args, typename C >
auto | bindSafe (void(C::*method)(Args...) const) const noexcept
| Protects a const method call against object destruction.
template<typename Function >
auto | bindSafe (const Function &function) noexcept
| Protects a function against object destruction.

## Static Public Attributes
static const Field | LoginNameField
| Login name field.

## Additional Inherited Members
Public Types inherited from Wt::WFormModel
typedef const char * | Field
| A type to identify a field.
Public Types inherited from Wt::WObject
typedef void(WObject::*) | Method()
| Typedef for a WObject method without arguments.
Static Public Member Functions inherited from Wt::WObject
Protected Member Functions inherited from Wt::WObject
virtual WStatelessSlot * | getStateless (Method method)
| On-demand stateless slot implementation.

## 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]

virtual 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]

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

Adds a list of OAuth authentication service providers.

See also
  addOAuth()

## ◆ addPasswordAuth()

virtual 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()

## ◆ addSaml()

virtual void Wt::Auth::FormBaseModel::addSaml | ( | const std::vector< const Saml::Service * > & | auth | ) |
| virtual

Adds a list of SAML authentication service providers.

See also
  addSaml()

## ◆ baseAuth()

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

Returns the authentication base service.

This returns the service passed through the constructor.

## ◆ label()

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

## ◆ loginUser()

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

## ◆ 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()

## ◆ saml()

std::vector< const Saml::Service * > Wt::Auth::FormBaseModel::saml | ( |  | ) | const

Returns the list of SAML authentication service providers.

See also
  addSaml()