Wt: Wt::Auth::IssuedToken Class Reference

Wt 4.10.4

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

Token or authorization code that was issued to a relying party. More...

`#include <IssuedToken.h>`

## Public Member Functions
| IssuedToken ()
| Default constructor.
| IssuedToken (const std::string &id, const AbstractUserDatabase &userDatabase)
| Constructor.
bool | checkValid () const
| Returns whether the token is valid.
const std::string | id () const
| Returns the user id.
const std::string | value () const
| Retrieves the string value that represents this token, usually random characters.
const WDateTime | expirationTime () const
| Retrieves the time when the token expires.
const std::string | purpose () const
| Retrieves the purpose of this token: authenication code, access token or refresh token.
const std::string | scope () const
| Retrieves the scope of this token as a space-separated string.
const std::string | redirectUri () const
| Retrieves the valid redirect uri of this token.
const User | user () const
| Retrieves the user that is associated with this token.
const OAuthClient | authClient () const
| Retrieves the client for which this token was issued.

## Detailed Description

Token or authorization code that was issued to a relying party.

This class represents an access token. It is a value class that stores only the id and a reference to an AbstractUserDatabase to access its properties.

An object can point to a valid token, or be invalid. Invalid tokens are typically used as return value for database queries which did not match with an existing client.

See also
  AbstractUserDatabase

## Constructor & Destructor Documentation

## ◆ IssuedToken() [1/2]

Wt::Auth::IssuedToken::IssuedToken | ( |  | ) |

Default constructor.

Creates an invalid token.

See also
  checkValid()

## ◆ IssuedToken() [2/2]

Wt::Auth::IssuedToken::IssuedToken | ( | const std::string & | id,
|  | const AbstractUserDatabase & | userDatabase )

Constructor.

Creates a user with id `id`, and whose information is stored in the `database`.

## Member Function Documentation

## ◆ checkValid()

bool Wt::Auth::IssuedToken::checkValid | ( |  | ) | const

Returns whether the token is valid.

A invalid token is a sentinel value returned by methods that query the database but could not identify a matching user.

## ◆ id()

const std::string Wt::Auth::IssuedToken::id | ( |  | ) | const

Returns the user id.

This returns the id that uniquely identifies the token, and acts as a "primary key" to obtain other information for the token in the database.

See also
  AbstractUserDatabase