NuguAuth.
More...
#include <nugu_auth.hh>
◆ discovery() [1/2]
bool NuguClientKit::NuguAuth::discovery |
( |
struct AuthResponse * |
response = nullptr | ) |
|
OAuth2 discovery to get OAuth2 end-point and server url.
- Parameters
-
[out] | response | HTTP response data |
- Returns
- result
- Return values
-
◆ discovery() [2/2]
bool NuguClientKit::NuguAuth::discovery |
( |
const std::function< void(bool success, const struct AuthResponse *response)> & |
cb | ) |
|
Async OAuth2 discovery to get OAuth2 end-point and server url.
- Parameters
-
[in] | cb | callback function to receive response |
- Returns
- result
- Return values
-
◆ isSupport()
bool NuguClientKit::NuguAuth::isSupport |
( |
const GrantType & |
gtype | ) |
|
Check whether the requested grant type is supported for the client.
- Parameters
-
- Returns
- result
- Return values
-
true | supported |
false | not supported |
◆ generateAuthorizeUrl()
std::string NuguClientKit::NuguAuth::generateAuthorizeUrl |
( |
const std::string & |
device_serial | ) |
|
Get OAuth2 authorization url.
- Parameters
-
[in] | device_serial | device serial info |
- Returns
- std::string authorization url
◆ getAuthorizationCodeToken()
NuguToken* NuguClientKit::NuguAuth::getAuthorizationCodeToken |
( |
const std::string & |
code, |
|
|
const std::string & |
device_serial, |
|
|
struct AuthResponse * |
response = nullptr |
|
) |
| |
Get the token using authorization code (token exchange)
- Parameters
-
[in] | code | OAuth2 authorization code |
[in] | device_serial | device serial info |
[out] | response | HTTP response data |
- Returns
- NuguToken* token information
◆ getClientCredentialsToken()
NuguToken* NuguClientKit::NuguAuth::getClientCredentialsToken |
( |
const std::string & |
device_serial, |
|
|
struct AuthResponse * |
response = nullptr |
|
) |
| |
Get the token using client credentials.
- Parameters
-
[in] | device_serial | device serial info |
[out] | response | HTTP response data |
- Returns
- NuguToken* token information
◆ parseAccessToken()
bool NuguClientKit::NuguAuth::parseAccessToken |
( |
NuguToken * |
token | ) |
|
Parsing the JWT access_token and fill the token information.
- Parameters
-
[in,out] | token | token information |
- Returns
- true parsing success
-
false parsing failed
◆ refresh()
bool NuguClientKit::NuguAuth::refresh |
( |
NuguToken * |
token, |
|
|
const std::string & |
device_serial = "" , |
|
|
struct AuthResponse * |
response = nullptr |
|
) |
| |
Refresh the access_token and update the token information.
- Parameters
-
[in,out] | token | token information |
[in] | device_serial | device serial info |
[out] | response | HTTP response data |
- Returns
- true success
-
false failure
◆ isExpired()
bool NuguClientKit::NuguAuth::isExpired |
( |
const NuguToken * |
token, |
|
|
time_t |
base_time = 0 |
|
) |
| |
Check the token is expired or not.
- Parameters
-
token[in] | token information |
base_time[in] | base timestamp(secs), '0' means the current timestamp |
- Returns
- true token is expired
-
false token is not expired
◆ getRemainExpireTime()
time_t NuguClientKit::NuguAuth::getRemainExpireTime |
( |
const NuguToken * |
token, |
|
|
time_t |
base_time = 0 |
|
) |
| |
Get remaining expiration time based on base_time.
- Parameters
-
token[in] | token information |
base_time[in] | base timestamp(secs), '0' means the current timestamp |
- Returns
- time_t remain secs. '0' means the token is expired
◆ getGatewayRegistryUri()
std::string NuguClientKit::NuguAuth::getGatewayRegistryUri |
( |
| ) |
|
Get uri for device gateway registry.
- Returns
- std::string uri
◆ getTemplateServerUri()
std::string NuguClientKit::NuguAuth::getTemplateServerUri |
( |
| ) |
|
Get uri for template server.
- Returns
- std::string uri
The documentation for this class was generated from the following file: