Wt: Wt::Auth::AuthTokenResult Class Reference

Wt 4.10.4

Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Wt::Auth::AuthTokenResult Class Reference

The result of processing an authentication token. More...

`#include <Wt/Auth/AuthService.h>`

## Public Types
typedef AuthTokenState | State
| Typedef for enum Wt::Auth::AuthTokenState.

## Public Member Functions
| AuthTokenResult (AuthTokenState state, const User &user=User(), const std::string &newToken=std::string(), int newTokenValidity=-1)
| Constructor.
AuthTokenState | state () const
| Returns the result.
const User & | user () const
| Returns the identified user.
std::string | newToken () const
| Returns a new token for this user.
int | newTokenValidity () const
| Returns the validity of the new token.

## Detailed Description

The result of processing an authentication token.

An authentication token is usually taken from a browser cookie, and used to identify (and possibly authenticate) a user across sessions.

See also
  AuthService::processAuthToken()
  AuthService::createAuthToken()

## Constructor & Destructor Documentation

## ◆ AuthTokenResult()

Wt::Auth::AuthTokenResult::AuthTokenResult | ( | AuthTokenState | state,
|  | const User & | user = User(),
|  | const std::string & | newToken = std::string(),
|  | int | newTokenValidity = -1 )

Constructor.

Creates an authentication token result.

## Member Function Documentation

## ◆ newToken()

std::string Wt::Auth::AuthTokenResult::newToken | ( |  | ) | const

Returns a new token for this user.

Returns the empty string if there is no new token. See AuthService::authTokenUpdateEnabled().

The returned token is valid only if the state() == AuthTokenState::Valid.

## ◆ newTokenValidity()

int Wt::Auth::AuthTokenResult::newTokenValidity | ( |  | ) | const

Returns the validity of the new token.

This returns the token validity in seconds.

Returns -1 if there is no new token, or result() != Valid.

See also
  newToken()

## ◆ user()

const User & Wt::Auth::AuthTokenResult::user | ( |  | ) | const

Returns the identified user.

The user is valid only if the the state() == AuthTokenState::Valid.