34 #ifndef GRPC_INTERNAL_CORE_SECURITY_CREDENTIALS_H
35 #define GRPC_INTERNAL_CORE_SECURITY_CREDENTIALS_H
55 #define GRPC_FAKE_TRANSPORT_SECURITY_TYPE "fake"
57 #define GRPC_CREDENTIALS_TYPE_SSL "Ssl"
58 #define GRPC_CREDENTIALS_TYPE_OAUTH2 "Oauth2"
59 #define GRPC_CREDENTIALS_TYPE_JWT "Jwt"
60 #define GRPC_CREDENTIALS_TYPE_IAM "Iam"
61 #define GRPC_CREDENTIALS_TYPE_COMPOSITE "Composite"
62 #define GRPC_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY "FakeTransportSecurity"
64 #define GRPC_AUTHORIZATION_METADATA_KEY "Authorization"
65 #define GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY \
66 "x-goog-iam-authorization-token"
67 #define GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY "x-goog-iam-authority-selector"
69 #define GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "gcloud"
70 #define GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE \
71 "application_default_credentials.json"
73 #define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60
75 #define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata"
76 #define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \
77 "/computeMetadata/v1/instance/service-accounts/default/token"
79 #define GRPC_GOOGLE_OAUTH2_SERVICE_HOST "www.googleapis.com"
80 #define GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH "/oauth2/v3/token"
82 #define GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX \
83 "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" \
86 #define GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING \
87 "client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token"
104 size_t initial_capacity);
110 const char *
key,
const char *
value);
136 const char *service_url,
157 const char *service_url,
195 const char *token_md_value,
int is_async);
grpc_credentials_status
Definition: credentials.h:50
const char * value
Definition: hpack_table.c:44
grpc_credentials_md_store * jwt_md
Definition: credentials.h:245
Definition: credentials.h:131
grpc_credentials_md * entries
Definition: credentials.h:97
Definition: credentials.h:210
int grpc_credentials_has_request_metadata_only(grpc_credentials *creds)
Definition: credentials.c:102
gpr_timespec jwt_lifetime
Definition: credentials.h:251
gpr_refcount refcount
Definition: credentials.h:100
Definition: sync_generic.h:49
void(* grpc_credentials_metadata_cb)(void *user_data, grpc_credentials_md *md_elems, size_t num_md, grpc_credentials_status status)
Definition: credentials.h:126
Definition: credentials.h:91
grpc_credentials_md_store * grpc_credentials_md_store_create(size_t initial_capacity)
Definition: credentials_metadata.c:48
An array of arguments that can be passed around.
Definition: grpc.h:113
Definition: credentials.h:268
Definition: credentials.h:279
grpc_credentials_md_store * access_token_md
Definition: credentials.h:304
const char * type
Definition: credentials.h:218
grpc_ssl_config config
Definition: credentials.h:228
grpc_credentials_status grpc_oauth2_token_fetcher_credentials_parse_server_response(const struct grpc_httpcli_response *response, grpc_credentials_md_store **token_md, gpr_timespec *token_lifetime)
char * service_url
Definition: credentials.h:246
int is_async
Definition: credentials.h:305
grpc_credentials_md_store * grpc_credentials_md_store_ref(grpc_credentials_md_store *store)
Definition: credentials_metadata.c:80
Definition: credentials.h:317
grpc_auth_json_key key
Definition: credentials.h:281
const grpc_credentials_vtable * vtable
Definition: credentials.h:146
grpc_credentials * grpc_service_account_jwt_access_credentials_create_from_auth_json_key(grpc_auth_json_key key, gpr_timespec token_lifetime)
Definition: credentials.c:407
grpc_oauth2_token_fetcher_credentials base
Definition: credentials.h:289
grpc_security_status grpc_credentials_create_security_connector(grpc_credentials *creds, const char *target, const grpc_channel_args *args, grpc_credentials *request_metadata_creds, grpc_channel_security_connector **sc, grpc_channel_args **new_args)
Definition: credentials.c:123
grpc_oauth2_token_fetcher_credentials base
Definition: credentials.h:280
grpc_auth_refresh_token refresh_token
Definition: credentials.h:290
grpc_credentials_md_store * iam_md
Definition: credentials.h:312
grpc_credentials * grpc_refresh_token_credentials_create_from_auth_refresh_token(grpc_auth_refresh_token token)
Definition: credentials.c:747
grpc_credentials * grpc_credentials_contains_type(grpc_credentials *creds, const char *type, grpc_credentials **composite_creds)
Definition: credentials.c:1157
void(* grpc_fetch_oauth2_func)(grpc_credentials_metadata_request *req, grpc_httpcli_context *http_context, grpc_pollset *pollset, grpc_httpcli_response_cb response_cb, gpr_timespec deadline)
Definition: credentials.h:262
int grpc_credentials_has_request_metadata(grpc_credentials *creds)
Definition: credentials.c:97
Definition: credentials.h:231
void grpc_credentials_md_store_add(grpc_credentials_md_store *store, gpr_slice key, gpr_slice value)
Definition: credentials_metadata.c:60
char * grpc_get_well_known_google_credentials_file_path(void)
Definition: pollset_posix.h:48
gpr_mu mu
Definition: credentials.h:270
size_t num_creds
Definition: credentials.h:172
grpc_auth_json_key key
Definition: credentials.h:250
Definition: credentials.h:216
Definition: credentials.h:145
Definition: credentials.h:170
Definition: credentials.h:295
Definition: credentials.h:96
gpr_slice value
Definition: credentials.h:93
void grpc_credentials_unref(grpc_credentials *creds)
Definition: credentials.c:88
const grpc_server_credentials_vtable * vtable
Definition: credentials.h:217
grpc_credentials base
Definition: credentials.h:303
void grpc_flush_cached_google_default_credentials(void)
Definition: google_default_credentials.c:213
grpc_credentials base
Definition: credentials.h:318
grpc_credentials * connector_creds
Definition: credentials.h:320
Definition: json_token.h:94
grpc_server_credentials * grpc_fake_transport_security_server_credentials_create(void)
Definition: credentials.c:938
size_t allocated
Definition: credentials.h:99
Definition: credentials.h:52
void grpc_credentials_get_request_metadata(grpc_credentials *creds, grpc_pollset *pollset, const char *service_url, grpc_credentials_metadata_cb cb, void *user_data)
Definition: credentials.c:107
Definition: credentials.h:310
gpr_timespec token_lifetime
Definition: credentials.h:283
size_t num_entries
Definition: credentials.h:98
gpr_refcount refcount
Definition: credentials.h:148
grpc_credentials_md_store * access_token_md
Definition: credentials.h:297
Definition: sync_win32.h:39
void grpc_credentials_md_store_unref(grpc_credentials_md_store *store)
Definition: credentials_metadata.c:87
Definition: security_connector.h:196
gpr_timespec jwt_expiration
Definition: credentials.h:247
Definition: security_connector.h:75
Definition: credentials.h:238
Definition: security_connector.h:135
Definition: json_token.h:52
Definition: credentials.h:226
grpc_credentials base
Definition: credentials.h:296
grpc_httpcli_context httpcli_context
Definition: credentials.h:273
grpc_credentials_array inner
Definition: credentials.h:319
const char * type
Definition: credentials.h:147
Definition: credentials.h:288
grpc_credentials * grpc_fake_transport_security_credentials_create(void)
Definition: credentials.c:929
gpr_mu cache_mu
Definition: credentials.h:243
gpr_timespec token_expiration
Definition: credentials.h:272
Definition: security_connector.h:165
Definition: credentials.h:51
gpr_slice key
Definition: credentials.h:92
const grpc_credentials_array * grpc_composite_credentials_get_credentials(grpc_credentials *composite_creds)
Definition: credentials.c:1149
void grpc_credentials_md_store_add_cstrings(grpc_credentials_md_store *store, const char *key, const char *value)
Definition: credentials_metadata.c:69
void(* grpc_httpcli_response_cb)(void *user_data, const grpc_httpcli_response *response)
Definition: httpcli.h:89
grpc_credentials * grpc_credentials_ref(grpc_credentials *creds)
Definition: credentials.c:82
grpc_credentials base
Definition: credentials.h:227
grpc_server_credentials base
Definition: credentials.h:232
grpc_credentials * grpc_fake_oauth2_credentials_create(const char *token_md_value, int is_async)
Definition: credentials.c:818
grpc_credentials base
Definition: credentials.h:311
Definition: credentials.h:302
grpc_credentials_md_store * access_token_md
Definition: credentials.h:271
grpc_security_status
Definition: security_connector.h:43
const char * key
Definition: hpack_table.c:43
grpc_fetch_oauth2_func fetch_func
Definition: credentials.h:274
grpc_security_status grpc_server_credentials_create_security_connector(grpc_server_credentials *creds, grpc_security_connector **sc)
Definition: credentials.c:143
grpc_credentials base
Definition: credentials.h:239
grpc_credentials ** creds_array
Definition: credentials.h:171
grpc_ssl_server_config config
Definition: credentials.h:233
char * scope
Definition: credentials.h:282
grpc_credentials base
Definition: credentials.h:269