17 #ifndef __NUGU_AUTH_H__
18 #define __NUGU_AUTH_H__
26 namespace NuguClientKit {
43 AUTHORIZATION_CODE = 0x1,
44 CLIENT_CREDENTIALS = 0x2,
53 std::string oauth_server_url;
54 std::string oauth_client_id;
55 std::string oauth_client_secret;
56 std::string oauth_redirect_uri;
57 std::string device_type_code;
65 std::string access_token;
66 std::string refresh_token;
67 std::string token_type;
71 std::vector<std::string> scope;
73 std::string client_id;
200 bool parseDiscoveryResult(
const std::string& response);
201 bool parseAndSaveToken(
const std::string& response,
NuguToken* token);
205 unsigned int supported_grant_types;
206 std::string ep_token;
207 std::string ep_authorization;
208 std::string uri_gateway_registry;
209 std::string uri_template_server;
NuguAuth.
Definition: nugu_auth.hh:93
time_t getRemainExpireTime(const NuguToken *token, time_t base_time=0)
Get remaining expiration time based on base_time.
bool parseAccessToken(NuguToken *token)
Parsing the JWT access_token and fill the token information.
bool isExpired(const NuguToken *token, time_t base_time=0)
Check the token is expired or not.
bool isSupport(const GrantType >ype)
Check whether the requested grant type is supported for the client.
bool discovery(const std::function< void(bool success, const struct AuthResponse *response)> &cb)
Async OAuth2 discovery to get OAuth2 end-point and server url.
bool discovery(struct AuthResponse *response=nullptr)
OAuth2 discovery to get OAuth2 end-point and server url.
NuguToken * getAuthorizationCodeToken(const std::string &code, const std::string &device_serial, struct AuthResponse *response=nullptr)
Get the token using authorization code (token exchange)
bool refresh(NuguToken *token, const std::string &device_serial="", struct AuthResponse *response=nullptr)
Refresh the access_token and update the token information.
std::string generateAuthorizeUrl(const std::string &device_serial)
Get OAuth2 authorization url.
NuguToken * getClientCredentialsToken(const std::string &device_serial, struct AuthResponse *response=nullptr)
Get the token using client credentials.
std::string getTemplateServerUri()
Get uri for template server.
std::string getGatewayRegistryUri()
Get uri for device gateway registry.
NUGU HTTP Rest.
Definition: nugu_http_rest.hh:42
GrantType
GrantType.
Definition: nugu_auth.hh:42
AuthResponse.
Definition: nugu_auth.hh:85
NuguDeviceConfig.
Definition: nugu_auth.hh:52
NuguToken.
Definition: nugu_auth.hh:64