Wt  4.11.1
Public Member Functions | Static Public Attributes | List of all members
Wt::Auth::OAuthAccessToken Class Reference

An OAuth access token. More...

#include <Wt/Auth/OAuthService.h>

Public Member Functions

 OAuthAccessToken ()
 Default constructor. More...
 
 OAuthAccessToken (const std::string &value, const WDateTime &expires, const std::string &refreshToken)
 Constructor.
 
 OAuthAccessToken (const std::string &value, const WDateTime &expires, const std::string &refreshToken, const std::string &idToken)
 Constructor with an OpenID Connect ID token.
 
bool isValid () const
 Returns whether the token is valid. More...
 
const std::string & value () const
 Returns the access token value. More...
 
WDateTime expires () const
 Returns the token expires time (if available). More...
 
const std::string & refreshToken () const
 Returns the refresh token (if available). More...
 

Static Public Attributes

static const OAuthAccessToken Invalid
 An invalid token constant. More...
 

Detailed Description

An OAuth access token.

A access token is the result of an authorization process, and encapsulates the authorization to access protected information.

Next to its value(), it also contains optionally an expires date and a refresh token.

See also
OAuthProcess::startAuthorize(), OAuthProcess::authorized()

Constructor & Destructor Documentation

◆ OAuthAccessToken()

Wt::Auth::OAuthAccessToken::OAuthAccessToken ( )

Default constructor.

Creates an invalid access token.

Member Function Documentation

◆ expires()

WDateTime Wt::Auth::OAuthAccessToken::expires ( ) const

Returns the token expires time (if available).

Returns a Null date-time if not available.

◆ isValid()

bool Wt::Auth::OAuthAccessToken::isValid ( ) const

Returns whether the token is valid.

An invalid access token is used to signal for example that the user denied the authorization request.

◆ refreshToken()

const std::string& Wt::Auth::OAuthAccessToken::refreshToken ( ) const

Returns the refresh token (if available).

The refresh token is an optional token that can be used when the access token has expired.

If not available, returns an empty string.

◆ value()

const std::string& Wt::Auth::OAuthAccessToken::value ( ) const

Returns the access token value.

This value can be used to access protected resources.

Member Data Documentation

◆ Invalid

const OAuthAccessToken Wt::Auth::OAuthAccessToken::Invalid
static

An invalid token constant.

This is a token that is not isValid().