|
GDAL
|
Manager of Google OAuth2 authentication. More...
#include <cpl_http.h>
Public Types | |
| enum | AuthMethod { NONE , GCE , ACCESS_TOKEN_FROM_REFRESH , SERVICE_ACCOUNT } |
| Authentication method. | |
Public Member Functions | |
| GOA2Manager () | |
| Constructor. | |
| bool | SetAuthFromGCE (CSLConstList papszOptions) |
| Specifies that the authentication will be done using the local credentials of the current Google Compute Engine VM. More... | |
| bool | SetAuthFromRefreshToken (const char *pszRefreshToken, const char *pszClientId, const char *pszClientSecret, CSLConstList papszOptions) |
| Specifies that the authentication will be done using the OAuth2 client id method. More... | |
| bool | SetAuthFromServiceAccount (const char *pszPrivateKey, const char *pszClientEmail, const char *pszScope, CSLConstList papszAdditionalClaims, CSLConstList papszOptions) |
| Specifies that the authentication will be done using the OAuth2 service account method. More... | |
| AuthMethod | GetAuthMethod () const |
| Returns the authentication method. | |
| const char * | GetBearer () const |
| Return the access token. More... | |
| const CPLString & | GetPrivateKey () const |
| Returns private key for SERVICE_ACCOUNT method. | |
| const CPLString & | GetClientEmail () const |
| Returns client email for SERVICE_ACCOUNT method. | |
Manager of Google OAuth2 authentication.
This class handles different authentication methods and handles renewal of access token.
| const char * GOA2Manager::GetBearer | ( | ) | const |
Return the access token.
This is the value to append to a "Authorization: Bearer " HTTP header.
A network request is issued only if no access token has been yet queried, or if its expiration delay has been reached.
| bool GOA2Manager::SetAuthFromGCE | ( | CSLConstList | papszOptions | ) |
Specifies that the authentication will be done using the local credentials of the current Google Compute Engine VM.
This queries http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token
| papszOptions | NULL terminated list of options. |
| bool GOA2Manager::SetAuthFromRefreshToken | ( | const char * | pszRefreshToken, |
| const char * | pszClientId, | ||
| const char * | pszClientSecret, | ||
| CSLConstList | papszOptions | ||
| ) |
Specifies that the authentication will be done using the OAuth2 client id method.
See http://code.google.com/apis/accounts/docs/OAuth2.html
| pszRefreshToken | refresh token. Must be non NULL. |
| pszClientId | client id (may be NULL, in which case the GOA2_CLIENT_ID configuration option is used) |
| pszClientSecret | client secret (may be NULL, in which case the GOA2_CLIENT_SECRET configuration option is used) |
| papszOptions | NULL terminated list of options, or NULL. |
| bool GOA2Manager::SetAuthFromServiceAccount | ( | const char * | pszPrivateKey, |
| const char * | pszClientEmail, | ||
| const char * | pszScope, | ||
| CSLConstList | papszAdditionalClaims, | ||
| CSLConstList | papszOptions | ||
| ) |
Specifies that the authentication will be done using the OAuth2 service account method.
See https://developers.google.com/identity/protocols/OAuth2ServiceAccount
| pszPrivateKey | RSA private key. Must be non NULL. |
| pszClientEmail | client email. Must be non NULL. |
| pszScope | authorization scope. Must be non NULL. |
| papszAdditionalClaims | NULL terminate list of additional claims, or NULL. |
| papszOptions | NULL terminated list of options, or NULL. |