19 #ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H 20 #define GRPC_CORE_LIB_SECURITY_CREDENTIALS_CREDENTIALS_H 46 #define GRPC_FAKE_TRANSPORT_SECURITY_TYPE "fake" 48 #define GRPC_CHANNEL_CREDENTIALS_TYPE_SSL "Ssl" 49 #define GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY \ 50 "FakeTransportSecurity" 51 #define GRPC_CHANNEL_CREDENTIALS_TYPE_GOOGLE_DEFAULT "GoogleDefault" 53 #define GRPC_CALL_CREDENTIALS_TYPE_OAUTH2 "Oauth2" 54 #define GRPC_CALL_CREDENTIALS_TYPE_JWT "Jwt" 55 #define GRPC_CALL_CREDENTIALS_TYPE_IAM "Iam" 56 #define GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE "Composite" 58 #define GRPC_AUTHORIZATION_METADATA_KEY "authorization" 59 #define GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY \ 60 "x-goog-iam-authorization-token" 61 #define GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY "x-goog-iam-authority-selector" 63 #define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60 65 #define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata.google.internal." 66 #define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \ 67 "/computeMetadata/v1/instance/service-accounts/default/token" 69 #define GRPC_GOOGLE_OAUTH2_SERVICE_HOST "oauth2.googleapis.com" 70 #define GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH "/token" 72 #define GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX \ 73 "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" \ 76 #define GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING \ 77 "client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token" 88 typedef char* (*grpc_well_known_credentials_path_getter)(void);
94 #define GRPC_ARG_CHANNEL_CREDENTIALS "grpc.channel_credentials" 136 const char* authority,
147 const char*
type()
const {
return type_; }
151 std::map<grpc_core::UniquePtr<char>,
154 local_control_plane_creds_;
247 const char*
type()
const {
return type_; }
256 const char* md_key,
const char* md_value,
bool is_async);
273 const char*
type()
const {
return type_; }
282 void DestroyProcessor() {
283 if (processor_.
destroy !=
nullptr && processor_.
state !=
nullptr) {
293 #define GRPC_SERVER_CREDENTIALS_ARG "grpc.server_credentials" grpc_credentials_status
Definition: credentials.h:41
void grpc_control_plane_credentials_init()
Definition: credentials.cc:62
Definition: credentials.h:205
grpc_arg grpc_channel_credentials_to_arg(grpc_channel_credentials *credentials)
Definition: credentials.cc:152
virtual ~grpc_channel_credentials()=default
grpc_call_credentials * grpc_md_only_test_credentials_create(const char *md_key, const char *md_value, bool is_async)
Definition: fake_credentials.cc:109
An array of arguments that can be passed around.
Definition: grpc_types.h:132
bool attach_credentials(const char *authority, grpc_core::RefCountedPtr< grpc_channel_credentials > control_plane_creds)
Definition: credentials.cc:101
Definition: credentials.h:99
virtual grpc_core::RefCountedPtr< grpc_channel_security_connector > create_security_connector(grpc_core::RefCountedPtr< grpc_call_credentials > call_creds, const char *target, const grpc_channel_args *args, grpc_channel_args **new_args)=0
RefCountedPtr< grpc_channel_credentials > Ref() GRPC_MUST_USE_RESULT
Definition: ref_counted.h:253
virtual grpc_core::RefCountedPtr< grpc_server_security_connector > create_security_connector()=0
const char * type() const
Definition: credentials.h:147
Definition: error_internal.h:39
grpc_arg grpc_server_credentials_to_arg(grpc_server_credentials *c)
Definition: credentials.cc:221
A single argument...
Definition: grpc_types.h:103
Definition: credentials.h:225
virtual bool get_request_metadata(grpc_polling_entity *pollent, grpc_auth_metadata_context context, grpc_credentials_mdelem_array *md_array, grpc_closure *on_request_metadata, grpc_error **error)=0
const char * type() const
Definition: credentials.h:273
virtual ~grpc_call_credentials()=default
char *(* grpc_well_known_credentials_path_getter)(void)
Definition: credentials.h:88
Definition: polling_entity.h:37
char * grpc_get_well_known_google_credentials_file_path(void)
Definition: google_default_credentials.cc:378
void grpc_credentials_metadata_request_destroy(grpc_credentials_metadata_request *r)
Definition: credentials.h:320
grpc_channel_credentials * grpc_channel_credentials_from_arg(const grpc_arg *arg)
Definition: credentials.cc:159
Definition: credentials.h:263
void grpc_override_well_known_credentials_path_getter(grpc_well_known_credentials_path_getter getter)
Definition: google_default_credentials.cc:383
const char * type() const
Definition: credentials.h:247
Definition: credentials.h:43
bool grpc_control_plane_credentials_register(const char *authority, grpc_channel_credentials *control_plane_creds)
EXPERIMENTAL.
Definition: credentials.cc:86
grpc_server_credentials * grpc_find_server_credentials_in_args(const grpc_channel_args *args)
Definition: credentials.cc:236
Definition: metadata.h:98
Definition: ref_counted_ptr.h:35
grpc_channel_credentials(const char *type)
Definition: credentials.h:102
void grpc_test_only_control_plane_credentials_destroy()
Definition: credentials.cc:67
void grpc_http_response_destroy(grpc_http_response *response)
Definition: parser.cc:344
grpc_server_credentials(const char *type)
Definition: credentials.h:266
grpc_server_credentials * grpc_server_credentials_from_arg(const grpc_arg *arg)
Definition: credentials.cc:226
A closure over a grpc_iomgr_cb_func.
Definition: closure.h:56
void set_auth_metadata_processor(const grpc_auth_metadata_processor &processor)
Definition: credentials.cc:188
Definition: ref_counted.h:248
virtual ~grpc_server_credentials()
Definition: credentials.h:268
void grpc_credentials_mdelem_array_add(grpc_credentials_mdelem_array *list, grpc_mdelem md)
Takes a new ref to md.
Definition: credentials_metadata.cc:42
char * grpc_get_well_known_google_credentials_file_path_impl(void)
Definition: credentials_generic.cc:30
virtual grpc_core::RefCountedPtr< grpc_channel_credentials > duplicate_without_call_credentials()
Definition: credentials.h:119
Definition: credentials.h:42
void grpc_credentials_mdelem_array_append(grpc_credentials_mdelem_array *dst, grpc_credentials_mdelem_array *src)
Appends all elements from src to dst, taking a new ref to each one.
Definition: credentials_metadata.cc:48
const grpc_auth_metadata_processor & auth_metadata_processor() const
Definition: credentials.h:275
virtual grpc_channel_args * update_arguments(grpc_channel_args *args)
Definition: credentials.h:128
virtual void cancel_get_request_metadata(grpc_credentials_mdelem_array *md_array, grpc_error *error)=0
grpc_call_credentials(const char *type)
Definition: credentials.h:228
grpc_core::RefCountedPtr< grpc_channel_credentials > get_control_plane_credentials(const char *authority)
Definition: credentials.cc:114
grpc_credentials_metadata_request * grpc_credentials_metadata_request_create(grpc_core::RefCountedPtr< grpc_call_credentials > creds)
Definition: credentials.h:315
grpc_channel_credentials * grpc_channel_credentials_find_in_args(const grpc_channel_args *args)
Definition: credentials.cc:170
void grpc_credentials_mdelem_array_destroy(grpc_credentials_mdelem_array *list)
Definition: credentials_metadata.cc:56
bool grpc_channel_credentials_attach_credentials(grpc_channel_credentials *credentials, const char *authority, grpc_channel_credentials *control_plane_creds)
EXPERIMENTAL.
Definition: credentials.cc:79
void grpc_test_only_control_plane_credentials_force_init()
Definition: credentials.cc:73
Context that can be used by metadata credentials plugin in order to create auth related metadata...
Definition: grpc_security.h:373