olp-cpp-sdk  1.19.0
Public Member Functions | List of all members
olp::authentication::TokenProvider< MinimumValidity > Class Template Reference

Provides the authentication tokens if the HERE platform user credentials are valid. More...

#include <TokenProvider.h>

Public Member Functions

 TokenProvider (Settings settings)
 Creates the TokenProvider instance with the settings parameter. More...
 
 TokenProvider (const TokenProvider &other)=default
 A default copy constructor.
 
 TokenProvider (TokenProvider &&other) noexcept=default
 A default move constructor.
 
TokenProvideroperator= (const TokenProvider &other)=default
 A default copy assignment operator.
 
TokenProvideroperator= (TokenProvider &&other) noexcept=default
 A default move assignment operator.
 
 operator bool () const
 Casts the TokenProvider instance to the bool type. More...
 
client::OauthTokenResponse operator() (client::CancellationContext &context) const
 Returns the access token or an error. More...
 
ErrorResponse GetErrorResponse () const
 Allows the olp::client::ApiError object associated with the last request to be accessed if the token request is unsuccessful. More...
 
int GetHttpStatusCode () const
 Gets the HTTP status code of the last request. More...
 

Detailed Description

template<uint64_t MinimumValidity>
class olp::authentication::TokenProvider< MinimumValidity >

Provides the authentication tokens if the HERE platform user credentials are valid.

Template Parameters
MinimumValidityThe minimum token validity time (in seconds). To use the default MinimumValidity value, use the TokenProviderDefault typedef.
See also
TokenProviderDefault

Constructor & Destructor Documentation

◆ TokenProvider()

template<uint64_t MinimumValidity>
olp::authentication::TokenProvider< MinimumValidity >::TokenProvider ( Settings  settings)
inlineexplicit

Creates the TokenProvider instance with the settings parameter.

Parameters
settingsThe settings that can be used to configure the TokenEndpoint instance.

Member Function Documentation

◆ GetErrorResponse()

template<uint64_t MinimumValidity>
ErrorResponse olp::authentication::TokenProvider< MinimumValidity >::GetErrorResponse ( ) const
inline

Allows the olp::client::ApiError object associated with the last request to be accessed if the token request is unsuccessful.

Returns
An error if the last token request failed.

◆ GetHttpStatusCode()

template<uint64_t MinimumValidity>
int olp::authentication::TokenProvider< MinimumValidity >::GetHttpStatusCode ( ) const
inline

Gets the HTTP status code of the last request.

Returns
The HTTP code of the last token request if it was successful. Otherwise, returns the HTTP 503 Service Unavailable server error.

◆ operator bool()

template<uint64_t MinimumValidity>
olp::authentication::TokenProvider< MinimumValidity >::operator bool ( ) const
inline

Casts the TokenProvider instance to the bool type.

Returns true if the previous token request was successful.

Returns
True if the previous token request was successful; false otherwise.

◆ operator()()

template<uint64_t MinimumValidity>
client::OauthTokenResponse olp::authentication::TokenProvider< MinimumValidity >::operator() ( client::CancellationContext context) const
inline

Returns the access token or an error.

Parameters
contextUsed to cancel the pending token request.
Returns
An OauthTokenResponse if the response is successful; an ApiError otherwise.

The documentation for this class was generated from the following file: