Wt  3.2.0
Public Types | Public Member Functions
Wt::Auth::RegistrationModel Class Reference

Model for implementing a registration view. More...

#include <Wt/Auth/RegistrationModel>

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

List of all members.

Public Types

enum  Field { LoginName, Password, Password2, Email }
 Enumeration for a field. More...
enum  EmailPolicy { EmailDisabled, EmailOptional, EmailMandatory }
 Enumeration for an email policy. More...
enum  IdentityConfirmationMethod { ConfirmWithPassword, ConfirmWithEmail, ConfirmationNotPossible }
 Method for confirming to be an existing user. More...

Public Member Functions

 RegistrationModel (const AuthService &baseAuth, AbstractUserDatabase &users, Login &login, WObject *parent=0)
 Constructor.
const AuthServicebaseAuth () const
 Returns the authentication base service.
Loginlogin ()
 Returns the login object.
AbstractUserDatabaseusers ()
 Returns the user database.
void addPasswordAuth (const AbstractPasswordService *auth)
 Adds a password authentication service.
const AbstractPasswordServicepasswordAuth () const
 Returns the password authentication service.
void addOAuth (const OAuthService *auth)
 Adds an OAuth authentication service provider.
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.
void setMinLoginNameLength (int chars)
 Configures a minimum length for a login name.
int minLoginNameLength () const
 Returns the minimum length for a login name.
void setEmailPolicy (EmailPolicy policy)
 Configures whether an email address needs to be entered.
EmailPolicy emailPolicy () const
 Returns the email policy.
virtual bool registerIdentified (const Identity &identity)
 Register a user authenticated by an identity provider.
User existingUser () const
 Returns the existing user that needs to be confirmed.
virtual IdentityConfirmationMethod confirmIsExistingUser () const
 Returns the method to be used to confirm to be an existing user.
virtual void existingUserConfirmed ()
 Confirms that the user is indeed an existing user.
virtual WString validateLoginName (const WString &userName) const
 Validates the login name.
virtual void checkUserExists (const WString &userName)
 Verifies that a user with that name does not yet exist.
virtual bool validate ()
 Validates the current input.
bool valid () const
 Returns the result of the last validation.
virtual User doRegister ()
 Performs the registration process.
virtual bool isVisible (Field field) const
 Returns whether a field should be shown.
virtual bool isReadOnly (Field field) const
 Returns whether a field is read only.
virtual WString label (Field field) const
 Returns a field label.
virtual void setValue (Field field, const WString &value)
 Sets the field value.
virtual const WStringvalue (Field field) const
 Returns the field value.
virtual bool validate (Field field)
 Validates a field.
const WValidator::ResultvalidationResult (Field field) const
 Returns the result of a validation.
virtual bool isConfirmUserButtonVisible () const
 Returns whether an existing user may be confirmed.
virtual bool isFederatedLoginVisible () const
 Returns whether federated login options can be shown.

Detailed Description

Model for implementing a registration view.

This model implements the logic for the registration of a new user. It can deal with traditional username/password registration, or registration of pre-identified users using federated login.

See also:
RegistrationWidget

Member Enumeration Documentation

Enumeration for an email policy.

Enumerator:
EmailDisabled 

The email address is not asked for.

EmailOptional 

A user may provide an email address, but it is optional.

EmailMandatory 

A user must provide an email address.

Enumeration for a field.

Enumerator:
LoginName 

Login name field.

Password 

Password field.

Password2 

Repeat password field.

Email 

Email field (if login name is not email)

Method for confirming to be an existing user.

Enumerator:
ConfirmWithPassword 

Confirm using a password prompt.

ConfirmWithEmail 

Confirm by using an email procedure.

ConfirmationNotPossible 

Confirmation is not possible.


Constructor & Destructor Documentation

Wt::Auth::RegistrationModel::RegistrationModel ( const AuthService baseAuth,
AbstractUserDatabase users,
Login login,
WObject parent = 0 
)

Constructor.

Creates a new registration model, using a basic authentication service and user database.

The login object is used to indicate that an existing user was re-identified, and thus the registration process may be aborted.


Member Function Documentation

void Wt::Auth::RegistrationModel::addOAuth ( const OAuthService auth)

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::RegistrationModel::addOAuth ( const std::vector< const OAuthService * > &  auth)

Adds a list of OAuth authentication service providers.

See also:
addOAuth()
void Wt::Auth::RegistrationModel::addPasswordAuth ( const AbstractPasswordService auth)

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::RegistrationModel::baseAuth ( ) const

Returns the authentication base service.

This returns the service passed through the constructor.

void Wt::Auth::RegistrationModel::checkUserExists ( const WString userName) [virtual]

Verifies that a user with that name does not yet exist.

If a user with that name already exists, it may in fact be the same user that is trying to register again (perhaps using a different identification method). If possible, we allow the user to confirm his identity.

RegistrationModel::IdentityConfirmationMethod Wt::Auth::RegistrationModel::confirmIsExistingUser ( ) const [virtual]

Returns the method to be used to confirm to be an existing user.

When the ConfirmExisting field is visible, this returns an appropriate method to use to let the user confirm that he is indeed the identified existing user.

The outcome of this method (if it is an online method, like a password prompt), if successful should be indicated using existingUserConfirmed().

See also:
existingUserConfirmed()
EmailPolicy Wt::Auth::RegistrationModel::emailPolicy ( ) const

Returns the email policy.

See also:
setEmailPolicy()
User Wt::Auth::RegistrationModel::existingUser ( ) const

Returns the existing user that needs to be confirmed.

When a user wishes to register with an identity that corresponds to an existing user, he ma be allowd to confirm that he is in fact this existing user.

See also:
confirmIsExistingUser()
void Wt::Auth::RegistrationModel::existingUserConfirmed ( ) [virtual]

Confirms that the user is indeed an existing user.

The new identity is added to this existing user (if applicable), and the user is logged in.

bool Wt::Auth::RegistrationModel::isConfirmUserButtonVisible ( ) const [virtual]

Returns whether an existing user may be confirmed.

This returns whether the user is being identified as an existing user and he can confirm that he is in fact the same user.

bool Wt::Auth::RegistrationModel::isFederatedLoginVisible ( ) const [virtual]

Returns whether federated login options can be shown.

This returns whether fields for federated login (such as OAuth) should be shown. These are typically buttons corresponding to identity providers.

The result of a federated authentication procedure should be indicated to registerIdentified().

int Wt::Auth::RegistrationModel::minLoginNameLength ( ) const

Returns the minimum length for a login name.

See also:
setMinLoginNameLength()
std::vector<const OAuthService *> Wt::Auth::RegistrationModel::oAuth ( ) const

Returns the list of OAuth authentication service providers.

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

Returns the password authentication service.

See also:
addPasswordAuth()
bool Wt::Auth::RegistrationModel::registerIdentified ( const Identity identity) [virtual]

Register a user authenticated by an identity provider.

Using a 3rd party authentication service such as OAuth, a user may be identified which is not yet registered with the web application.

Then, you may still need to allow the user to complete registration, but because the user already is identified and authenticated, this simplifies the registration form, since fields related to authentication can be dropped.

Returns true if the given identity was already registered, and has been logged in.

void Wt::Auth::RegistrationModel::setEmailPolicy ( EmailPolicy  policy)

Configures whether an email address needs to be entered.

You may specify whether you want the user to enter an email address.

This has no effect when the IdentityPolicy is EmailAddressIdentity.

The default policy is:

  • Optional when email address verification is enabled
  • Invisible otherwise
void Wt::Auth::RegistrationModel::setMinLoginNameLength ( int  chars)

Configures a minimum length for a login name.

The default value is 4.

bool Wt::Auth::RegistrationModel::valid ( ) const

Returns the result of the last validation.

See also:
validate()
bool Wt::Auth::RegistrationModel::validate ( ) [virtual]

Validates the current input.

If validation is successful, then a new user can be registered using doRegister()

bool Wt::Auth::RegistrationModel::validate ( Field  field) [virtual]

Validates a field.

See also:
validate(), validationResult()
WString Wt::Auth::RegistrationModel::validateLoginName ( const WString userName) const [virtual]

Validates the login name.

This verifies that the login name is adequate (see also setMinLoginNameLength()).

const WValidator::Result & Wt::Auth::RegistrationModel::validationResult ( Field  field) const

Returns the result of a validation.

See also:
validate()
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator

Generated on Tue Nov 29 2011 for the C++ Web Toolkit (Wt) by doxygen 1.7.5.1