GRPC Core  9.0.0
Namespaces | Functions
oauth2_credentials.cc File Reference
#include <grpc/support/port_platform.h>
#include "src/core/lib/json/json.h"
#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"
#include <string.h>
#include <grpc/grpc_security.h>
#include <grpc/impl/codegen/slice.h>
#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/gprpp/inlined_vector.h"
#include "src/core/lib/gprpp/ref_counted_ptr.h"
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/util/json_util.h"
#include "src/core/lib/slice/slice_internal.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/uri/uri_parser.h"

Namespaces

 grpc_core
 Round Robin Policy.
 

Functions

int grpc_auth_refresh_token_is_valid (const grpc_auth_refresh_token *refresh_token)
 Returns 1 if the object is valid, 0 otherwise. More...
 
grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json (const grpc_json *json)
 Creates a refresh token object from parsed json. More...
 
grpc_auth_refresh_token grpc_auth_refresh_token_create_from_string (const char *json_string)
 Creates a refresh token object from string. More...
 
void grpc_auth_refresh_token_destruct (grpc_auth_refresh_token *refresh_token)
 Destructs the object. More...
 
grpc_credentials_status grpc_oauth2_token_fetcher_credentials_parse_server_response (const grpc_http_response *response, grpc_mdelem *token_md, grpc_millis *token_lifetime)
 
grpc_call_credentialsgrpc_google_compute_engine_credentials_create (void *reserved)
 Creates a compute engine credentials object for connecting to Google. More...
 
grpc_core::RefCountedPtr< grpc_call_credentialsgrpc_refresh_token_credentials_create_from_auth_refresh_token (grpc_auth_refresh_token refresh_token)
 
grpc_call_credentialsgrpc_google_refresh_token_credentials_create (const char *json_refresh_token, void *reserved)
 Creates an Oauth2 Refresh Token credentials object for connecting to Google. More...
 
grpc_errorgrpc_core::ValidateStsCredentialsOptions (const grpc_sts_credentials_options *options, grpc_uri **sts_url_out)
 
grpc_call_credentialsgrpc_sts_credentials_create (const grpc_sts_credentials_options *options, void *reserved)
 Creates an STS credentials following the STS Token Exchanged specifed in the IETF draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16. More...
 
grpc_call_credentialsgrpc_access_token_credentials_create (const char *access_token, void *reserved)
 Creates an Oauth2 Access Token credentials with an access token that was acquired by an out of band mechanism. More...
 

Function Documentation

◆ grpc_access_token_credentials_create()

grpc_call_credentials* grpc_access_token_credentials_create ( const char *  access_token,
void *  reserved 
)

Creates an Oauth2 Access Token credentials with an access token that was acquired by an out of band mechanism.

◆ grpc_auth_refresh_token_create_from_json()

grpc_auth_refresh_token grpc_auth_refresh_token_create_from_json ( const grpc_json json)

Creates a refresh token object from parsed json.

Returns an invalid object if a parsing error has been encountered.

◆ grpc_auth_refresh_token_create_from_string()

grpc_auth_refresh_token grpc_auth_refresh_token_create_from_string ( const char *  json_string)

Creates a refresh token object from string.

Returns an invalid object if a parsing error has been encountered.

◆ grpc_auth_refresh_token_destruct()

void grpc_auth_refresh_token_destruct ( grpc_auth_refresh_token refresh_token)

Destructs the object.

◆ grpc_auth_refresh_token_is_valid()

int grpc_auth_refresh_token_is_valid ( const grpc_auth_refresh_token refresh_token)

Returns 1 if the object is valid, 0 otherwise.

◆ grpc_google_compute_engine_credentials_create()

grpc_call_credentials* grpc_google_compute_engine_credentials_create ( void *  reserved)

Creates a compute engine credentials object for connecting to Google.

WARNING: Do NOT use this credentials to connect to a non-google service as this could result in an oauth2 token leak.

◆ grpc_google_refresh_token_credentials_create()

grpc_call_credentials* grpc_google_refresh_token_credentials_create ( const char *  json_refresh_token,
void *  reserved 
)

Creates an Oauth2 Refresh Token credentials object for connecting to Google.

May return NULL if the input is invalid. WARNING: Do NOT use this credentials to connect to a non-google service as this could result in an oauth2 token leak.

  • json_refresh_token is the JSON string containing the refresh token itself along with a client_id and client_secret.

◆ grpc_oauth2_token_fetcher_credentials_parse_server_response()

grpc_credentials_status grpc_oauth2_token_fetcher_credentials_parse_server_response ( const grpc_http_response response,
grpc_mdelem token_md,
grpc_millis token_lifetime 
)

◆ grpc_refresh_token_credentials_create_from_auth_refresh_token()

grpc_core::RefCountedPtr<grpc_call_credentials> grpc_refresh_token_credentials_create_from_auth_refresh_token ( grpc_auth_refresh_token  refresh_token)

◆ grpc_sts_credentials_create()

grpc_call_credentials* grpc_sts_credentials_create ( const grpc_sts_credentials_options options,
void *  reserved 
)

Creates an STS credentials following the STS Token Exchanged specifed in the IETF draft https://tools.ietf.org/html/draft-ietf-oauth-token-exchange-16.

This API is used for experimental purposes for now and may change in the future.