10Duke Scale C++ Client
All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
OAuthState.h
1#ifndef TENDUKE_OAUTH_OAUTHSTATE_H
2#define TENDUKE_OAUTH_OAUTHSTATE_H
3
4#include <cstdint>
5#include <map>
6#include <string>
7
8namespace tenduke { namespace oauth {
9
10
12const std::int64_t TOKEN_DOES_NOT_EXPIRE = INT64_MAX;
13
18
19public:
20 virtual ~OAuthState() = default;
21
23 virtual const std::string & getAccessToken() const = 0;
24
29 virtual const std::string & getRefreshToken() const = 0;
30
36 virtual std::int64_t getExpiresAt() const = 0;
37
42 virtual const std::map<std::string, std::string> & getAdditionalProperties() const = 0;
43
49 virtual const std::string * getAdditionalProperty(const std::string &name) const = 0;
50
56 virtual bool hasAdditionalProperty(const std::string &name) const = 0;
57
62 virtual void removeAdditionalProperty(const std::string &propertyName) = 0;
63
64
70 virtual bool hasAccessToken() const = 0;
71
76 virtual bool doesExpire() const = 0;
77
82 virtual bool isRefreshable() const = 0;
83
88 virtual void setAccessToken(const std::string &newAccessToken) = 0;
89
94 virtual void setExpiresAt(std::int64_t newExpiresAt) = 0;
95
100 virtual void setRefreshToken(const std::string &newRefreshToken) = 0;
101
106 virtual void refreshFrom(const OAuthState &state) = 0;
107};
108
109}}
110
111#endif //TENDUKE_OAUTH_OAUTHSTATE_H
OAuth session state.
Definition OAuthState.h:17
virtual bool hasAccessToken() const =0
Returns true if the state contains an access token.
virtual void setRefreshToken(const std::string &newRefreshToken)=0
Set the refresh token.
virtual std::int64_t getExpiresAt() const =0
Returns timestamp (as epoch seconds) when the current access token expires.
virtual const std::string & getAccessToken() const =0
Returns the access token.
virtual bool isRefreshable() const =0
Returns true if the state is refreshable (i.e.
virtual const std::string & getRefreshToken() const =0
Returns the refresh token.
virtual const std::string * getAdditionalProperty(const std::string &name) const =0
Returns additional property returned by the server.
virtual void refreshFrom(const OAuthState &state)=0
Refreshes the state from another state, This is called after refreshing the state with the service.
virtual const std::map< std::string, std::string > & getAdditionalProperties() const =0
Returns all additional properties returned by the server.
virtual void setAccessToken(const std::string &newAccessToken)=0
Set the access token.
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 void setExpiresAt(std::int64_t newExpiresAt)=0
Set the "expires at".
virtual bool doesExpire() const =0
Returns true if the access token expires.
OAuth services.
Definition AccessTokenRequestAuthenticator.h:8
Root for classes, functions and globals of 10Duke C++ Client.
Definition BackendConfiguration.h:7