10Duke Scale C++ Client
Loading...
Searching...
No Matches
tenduke::oauth::OAuthStateService Class Referenceabstract

#include <OAuthStateService.h>

Detailed Description

OAuth-state after successful authentication.

Inheritance diagram for tenduke::oauth::OAuthStateService:
tenduke::oauth::OAuthState tenduke::oauth::OAuthStateServiceImpl

Public Member Functions

virtual bool refresh ()=0
 Refresh the state, i.e.
 
- Public Member Functions inherited from tenduke::oauth::OAuthState
virtual const std::string & getAccessToken () const =0
 Returns the access token.
 
virtual const std::string & getRefreshToken () const =0
 Returns the refresh token.
 
virtual std::int64_t getExpiresAt () const =0
 Returns timestamp (as epoch seconds) when the current access token expires.
 
virtual const std::map< std::string, std::string > & getAdditionalProperties () const =0
 Returns all additional properties returned by the server.
 
virtual const std::string * getAdditionalProperty (const std::string &name) const =0
 Returns additional property returned by the server.
 
virtual bool hasAdditionalProperty (const std::string &name) const =0
 Checks if the state has additional property.
 
virtual void removeAdditionalProperty (const std::string &propertyName)=0
 Removes given additional property.
 
virtual bool hasAccessToken () const =0
 Returns true if the state contains an access token.
 
virtual bool doesExpire () const =0
 Returns true if the access token expires.
 
virtual bool isRefreshable () const =0
 Returns true if the state is refreshable (i.e.
 
virtual void setAccessToken (const std::string &newAccessToken)=0
 Set the access token.
 
virtual void setExpiresAt (std::int64_t newExpiresAt)=0
 Set the "expires at".
 
virtual void setRefreshToken (const std::string &newRefreshToken)=0
 Set the refresh token.
 
virtual void refreshFrom (const OAuthState &state)=0
 Refreshes the state from another state, This is called after refreshing the state with the service.
 

Member Function Documentation

◆ refresh()

virtual bool tenduke::oauth::OAuthStateService::refresh ( )
pure virtual

Refresh the state, i.e.

requests new access token. The refresh is done synchronously.

Returns
true if refreshed. Returns false if nothing was done (because the state does not contain refresh token).
Exceptions
tenduke::oauth::OAuthServerExceptionwhen the server responds with an error
tenduke::oauth::OAuthExceptionwhen the server response is not what we expected, e.g.
  • The response does not contain access_token
  • The response payload is not JSON-object
tenduke::json::JSONParsingExceptionwhen response is not valid JSON
tenduke::net::NetworkingException(or subclasses of it) when networking error occurred, e.g.
tenduke::http::HTTPException(or subclasses of it) when the server responds with HTTP error status code which does not indicate OAuth-error, e.g. 500 (internal server error) or 404 (not found = wrong endpoint configured).

Implemented in tenduke::oauth::OAuthStateServiceImpl.


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