blob: c1f451ded11a3c66e08490327373c823856d76d0 [file] [log] [blame]
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08001/*
2 *
Julien Boeuf4f4d37c2016-02-24 22:07:36 -08003 * Copyright 2015-2016, Google Inc.
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -08004 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are
8 * met:
9 *
10 * * Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * * Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following disclaimer
14 * in the documentation and/or other materials provided with the
15 * distribution.
16 * * Neither the name of Google Inc. nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 *
32 */
33
Craig Tiller9a4dddd2016-03-25 17:08:13 -070034#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_H
35#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_H
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080036
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080037#include <grpc/grpc.h>
38#include <grpc/grpc_security.h>
39#include <grpc/support/sync.h>
Craig Tillerf40df232016-03-25 13:38:14 -070040#include "src/core/transport/metadata_batch.h"
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080041
Matthew Iselin1824f052016-02-10 12:16:06 +110042#include "src/core/http/httpcli.h"
43#include "src/core/http/parser.h"
Julien Boeuf54006062015-07-07 19:13:04 -070044#include "src/core/security/json_token.h"
Julien Boeuf7d1d9ca2015-04-17 14:38:48 -070045#include "src/core/security/security_connector.h"
46
Matthew Iselin1824f052016-02-10 12:16:06 +110047struct grpc_http_response;
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080048
49/* --- Constants. --- */
50
Craig Tillera82950e2015-09-22 12:33:20 -070051typedef enum {
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080052 GRPC_CREDENTIALS_OK = 0,
53 GRPC_CREDENTIALS_ERROR
54} grpc_credentials_status;
55
yang-g8b25f2a2015-07-21 23:54:36 -070056#define GRPC_FAKE_TRANSPORT_SECURITY_TYPE "fake"
57
Julien Boeufacd835f2015-10-09 15:20:57 -070058#define GRPC_CHANNEL_CREDENTIALS_TYPE_SSL "Ssl"
59#define GRPC_CHANNEL_CREDENTIALS_TYPE_FAKE_TRANSPORT_SECURITY \
60 "FakeTransportSecurity"
61
62#define GRPC_CALL_CREDENTIALS_TYPE_OAUTH2 "Oauth2"
Julien Boeufacd835f2015-10-09 15:20:57 -070063#define GRPC_CALL_CREDENTIALS_TYPE_JWT "Jwt"
64#define GRPC_CALL_CREDENTIALS_TYPE_IAM "Iam"
65#define GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE "Composite"
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -080066
Julien Boeuf4e02e842015-10-09 22:49:42 -070067#define GRPC_AUTHORIZATION_METADATA_KEY "authorization"
nnoble0c475f02014-12-05 15:37:39 -080068#define GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY \
69 "x-goog-iam-authorization-token"
70#define GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY "x-goog-iam-authority-selector"
71
Julien Boeufcd9b1c82015-02-20 17:40:41 -080072#define GRPC_GOOGLE_CLOUD_SDK_CONFIG_DIRECTORY "gcloud"
73#define GRPC_GOOGLE_WELL_KNOWN_CREDENTIALS_FILE \
74 "application_default_credentials.json"
75
Julien Boeuf9835cf02015-03-09 16:56:44 -070076#define GRPC_SECURE_TOKEN_REFRESH_THRESHOLD_SECS 60
77
78#define GRPC_COMPUTE_ENGINE_METADATA_HOST "metadata"
79#define GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH \
80 "/computeMetadata/v1/instance/service-accounts/default/token"
81
82#define GRPC_GOOGLE_OAUTH2_SERVICE_HOST "www.googleapis.com"
83#define GRPC_GOOGLE_OAUTH2_SERVICE_TOKEN_PATH "/oauth2/v3/token"
84
85#define GRPC_SERVICE_ACCOUNT_POST_BODY_PREFIX \
86 "grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt-bearer&" \
87 "assertion="
88
89#define GRPC_REFRESH_TOKEN_POST_BODY_FORMAT_STRING \
90 "client_id=%s&client_secret=%s&refresh_token=%s&grant_type=refresh_token"
91
Julien Boeufacd835f2015-10-09 15:20:57 -070092/* --- Google utils --- */
93
94/* It is the caller's responsibility to gpr_free the result if not NULL. */
95char *grpc_get_well_known_google_credentials_file_path(void);
96
Julien Boeuf2408a1c2015-12-09 22:33:41 -080097/* Implementation function for the different platforms. */
98char *grpc_get_well_known_google_credentials_file_path_impl(void);
99
100/* Override for testing only. Not thread-safe */
101typedef char *(*grpc_well_known_credentials_path_getter)(void);
102void grpc_override_well_known_credentials_path_getter(
103 grpc_well_known_credentials_path_getter getter);
104
Julien Boeufacd835f2015-10-09 15:20:57 -0700105/* --- grpc_channel_credentials. --- */
106
107typedef struct {
108 void (*destruct)(grpc_channel_credentials *c);
Julien Boeuf441176d2015-10-09 21:14:07 -0700109
Julien Boeufacd835f2015-10-09 15:20:57 -0700110 grpc_security_status (*create_security_connector)(
Julien Boeufb73cbc22015-10-20 21:52:54 -0700111 grpc_channel_credentials *c, grpc_call_credentials *call_creds,
112 const char *target, const grpc_channel_args *args,
113 grpc_channel_security_connector **sc, grpc_channel_args **new_args);
Julien Boeufacd835f2015-10-09 15:20:57 -0700114} grpc_channel_credentials_vtable;
115
116struct grpc_channel_credentials {
117 const grpc_channel_credentials_vtable *vtable;
118 const char *type;
119 gpr_refcount refcount;
Julien Boeufacd835f2015-10-09 15:20:57 -0700120};
121
122grpc_channel_credentials *grpc_channel_credentials_ref(
123 grpc_channel_credentials *creds);
124void grpc_channel_credentials_unref(grpc_channel_credentials *creds);
125
126/* Creates a security connector for the channel. May also create new channel
127 args for the channel to be used in place of the passed in const args if
128 returned non NULL. In that case the caller is responsible for destroying
129 new_args after channel creation. */
130grpc_security_status grpc_channel_credentials_create_security_connector(
131 grpc_channel_credentials *creds, const char *target,
Julien Boeuf441176d2015-10-09 21:14:07 -0700132 const grpc_channel_args *args, grpc_channel_security_connector **sc,
133 grpc_channel_args **new_args);
Julien Boeufacd835f2015-10-09 15:20:57 -0700134
Julien Boeuf75c9b6f2015-05-29 13:12:12 -0700135/* --- grpc_credentials_md. --- */
136
Craig Tillera82950e2015-09-22 12:33:20 -0700137typedef struct {
Julien Boeuf75c9b6f2015-05-29 13:12:12 -0700138 gpr_slice key;
139 gpr_slice value;
140} grpc_credentials_md;
141
Craig Tillera82950e2015-09-22 12:33:20 -0700142typedef struct {
Julien Boeuf75c9b6f2015-05-29 13:12:12 -0700143 grpc_credentials_md *entries;
144 size_t num_entries;
145 size_t allocated;
146 gpr_refcount refcount;
147} grpc_credentials_md_store;
148
Craig Tillera82950e2015-09-22 12:33:20 -0700149grpc_credentials_md_store *grpc_credentials_md_store_create(
150 size_t initial_capacity);
Julien Boeuf75c9b6f2015-05-29 13:12:12 -0700151
152/* Will ref key and value. */
Craig Tillera82950e2015-09-22 12:33:20 -0700153void grpc_credentials_md_store_add(grpc_credentials_md_store *store,
154 gpr_slice key, gpr_slice value);
155void grpc_credentials_md_store_add_cstrings(grpc_credentials_md_store *store,
156 const char *key, const char *value);
157grpc_credentials_md_store *grpc_credentials_md_store_ref(
158 grpc_credentials_md_store *store);
159void grpc_credentials_md_store_unref(grpc_credentials_md_store *store);
Julien Boeuf75c9b6f2015-05-29 13:12:12 -0700160
Julien Boeufacd835f2015-10-09 15:20:57 -0700161/* --- grpc_call_credentials. --- */
Julien Boeufcd9b1c82015-02-20 17:40:41 -0800162
Craig Tillera82950e2015-09-22 12:33:20 -0700163typedef void (*grpc_credentials_metadata_cb)(grpc_exec_ctx *exec_ctx,
164 void *user_data,
165 grpc_credentials_md *md_elems,
166 size_t num_md,
167 grpc_credentials_status status);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800168
Craig Tillera82950e2015-09-22 12:33:20 -0700169typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700170 void (*destruct)(grpc_call_credentials *c);
Julien Boeufacd835f2015-10-09 15:20:57 -0700171 void (*get_request_metadata)(grpc_exec_ctx *exec_ctx,
172 grpc_call_credentials *c, grpc_pollset *pollset,
Julien Boeuf3c957e62015-11-18 21:33:58 -0800173 grpc_auth_metadata_context context,
Craig Tillera82950e2015-09-22 12:33:20 -0700174 grpc_credentials_metadata_cb cb,
175 void *user_data);
Julien Boeufacd835f2015-10-09 15:20:57 -0700176} grpc_call_credentials_vtable;
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800177
Julien Boeufacd835f2015-10-09 15:20:57 -0700178struct grpc_call_credentials {
179 const grpc_call_credentials_vtable *vtable;
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800180 const char *type;
181 gpr_refcount refcount;
182};
183
Julien Boeuf441176d2015-10-09 21:14:07 -0700184grpc_call_credentials *grpc_call_credentials_ref(grpc_call_credentials *creds);
Julien Boeufacd835f2015-10-09 15:20:57 -0700185void grpc_call_credentials_unref(grpc_call_credentials *creds);
Nicolas "Pixel" Noblef9c58f32015-12-01 22:40:44 +0100186void grpc_call_credentials_get_request_metadata(
187 grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds,
188 grpc_pollset *pollset, grpc_auth_metadata_context context,
189 grpc_credentials_metadata_cb cb, void *user_data);
Craig Tillerc4885ed2015-04-14 09:51:28 -0700190
Craig Tillera82950e2015-09-22 12:33:20 -0700191typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700192 grpc_call_credentials **creds_array;
nnoble0c475f02014-12-05 15:37:39 -0800193 size_t num_creds;
Julien Boeufacd835f2015-10-09 15:20:57 -0700194} grpc_call_credentials_array;
nnoble0c475f02014-12-05 15:37:39 -0800195
Craig Tillerb1136492015-11-18 11:30:17 -0800196const grpc_call_credentials_array *
197grpc_composite_call_credentials_get_credentials(
Julien Boeufacd835f2015-10-09 15:20:57 -0700198 grpc_call_credentials *composite_creds);
nnoble0c475f02014-12-05 15:37:39 -0800199
jboeuf6ad120e2015-01-12 17:08:15 -0800200/* Returns creds if creds is of the specified type or the inner creds of the
201 specified type (if found), if the creds is of type COMPOSITE.
202 If composite_creds is not NULL, *composite_creds will point to creds if of
203 type COMPOSITE in case of success. */
Julien Boeufacd835f2015-10-09 15:20:57 -0700204grpc_call_credentials *grpc_credentials_contains_type(
205 grpc_call_credentials *creds, const char *type,
206 grpc_call_credentials **composite_creds);
jboeuf6ad120e2015-01-12 17:08:15 -0800207
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800208/* Exposed for testing only. */
Craig Tillera82950e2015-09-22 12:33:20 -0700209grpc_credentials_status
210grpc_oauth2_token_fetcher_credentials_parse_server_response(
Matthew Iselin1824f052016-02-10 12:16:06 +1100211 const struct grpc_http_response *response,
Craig Tillera82950e2015-09-22 12:33:20 -0700212 grpc_credentials_md_store **token_md, gpr_timespec *token_lifetime);
Julien Boeuf2408a1c2015-12-09 22:33:41 -0800213
Craig Tillera82950e2015-09-22 12:33:20 -0700214void grpc_flush_cached_google_default_credentials(void);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800215
Julien Boeufea456fc2015-07-07 15:23:30 -0700216/* Metadata-only credentials with the specified key and value where
217 asynchronicity can be simulated for testing. */
Julien Boeufacd835f2015-10-09 15:20:57 -0700218grpc_call_credentials *grpc_md_only_test_credentials_create(
219 const char *md_key, const char *md_value, int is_async);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800220
Julien Boeuf54006062015-07-07 19:13:04 -0700221/* Private constructor for jwt credentials from an already parsed json key.
222 Takes ownership of the key. */
Julien Boeufacd835f2015-10-09 15:20:57 -0700223grpc_call_credentials *
Craig Tillera82950e2015-09-22 12:33:20 -0700224grpc_service_account_jwt_access_credentials_create_from_auth_json_key(
225 grpc_auth_json_key key, gpr_timespec token_lifetime);
Julien Boeuf54006062015-07-07 19:13:04 -0700226
227/* Private constructor for refresh token credentials from an already parsed
228 refresh token. Takes ownership of the refresh token. */
Julien Boeufacd835f2015-10-09 15:20:57 -0700229grpc_call_credentials *
230grpc_refresh_token_credentials_create_from_auth_refresh_token(
Craig Tillera82950e2015-09-22 12:33:20 -0700231 grpc_auth_refresh_token token);
Julien Boeuf54006062015-07-07 19:13:04 -0700232
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800233/* --- grpc_server_credentials. --- */
234
Craig Tillera82950e2015-09-22 12:33:20 -0700235typedef struct {
236 void (*destruct)(grpc_server_credentials *c);
237 grpc_security_status (*create_security_connector)(
Julien Boeuf4f4d37c2016-02-24 22:07:36 -0800238 grpc_server_credentials *c, grpc_server_security_connector **sc);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800239} grpc_server_credentials_vtable;
240
Craig Tillera82950e2015-09-22 12:33:20 -0700241struct grpc_server_credentials {
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800242 const grpc_server_credentials_vtable *vtable;
243 const char *type;
Julien Boeuffe1478f2015-08-30 21:57:38 -0700244 gpr_refcount refcount;
Julien Boeuf6bdc9b42015-07-19 21:56:02 -0700245 grpc_auth_metadata_processor processor;
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800246};
247
Craig Tillera82950e2015-09-22 12:33:20 -0700248grpc_security_status grpc_server_credentials_create_security_connector(
Julien Boeuf4f4d37c2016-02-24 22:07:36 -0800249 grpc_server_credentials *creds, grpc_server_security_connector **sc);
Nicolas Nobleb7ebd3b2014-11-26 16:33:03 -0800250
Craig Tillera82950e2015-09-22 12:33:20 -0700251grpc_server_credentials *grpc_server_credentials_ref(
252 grpc_server_credentials *creds);
Julien Boeuffe1478f2015-08-30 21:57:38 -0700253
Craig Tillera82950e2015-09-22 12:33:20 -0700254void grpc_server_credentials_unref(grpc_server_credentials *creds);
Julien Boeuffe1478f2015-08-30 21:57:38 -0700255
Julien Boeuf9a529082015-10-08 13:12:14 -0700256#define GRPC_SERVER_CREDENTIALS_ARG "grpc.server_credentials"
257
258grpc_arg grpc_server_credentials_to_arg(grpc_server_credentials *c);
259grpc_server_credentials *grpc_server_credentials_from_arg(const grpc_arg *arg);
260grpc_server_credentials *grpc_find_server_credentials_in_args(
261 const grpc_channel_args *args);
262
Julien Boeufacd835f2015-10-09 15:20:57 -0700263/* -- Fake transport security credentials. -- */
264
265/* Creates a fake transport security credentials object for testing. */
266grpc_channel_credentials *grpc_fake_transport_security_credentials_create(void);
267/* Creates a fake server transport security credentials object for testing. */
268grpc_server_credentials *grpc_fake_transport_security_server_credentials_create(
269 void);
270
Julien Boeufb037bb62015-07-08 14:58:14 -0700271/* -- Ssl credentials. -- */
272
Craig Tillera82950e2015-09-22 12:33:20 -0700273typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700274 grpc_channel_credentials base;
Julien Boeufb037bb62015-07-08 14:58:14 -0700275 grpc_ssl_config config;
276} grpc_ssl_credentials;
277
Craig Tillera82950e2015-09-22 12:33:20 -0700278typedef struct {
Julien Boeufb037bb62015-07-08 14:58:14 -0700279 grpc_server_credentials base;
280 grpc_ssl_server_config config;
281} grpc_ssl_server_credentials;
282
Julien Boeufb73cbc22015-10-20 21:52:54 -0700283/* -- Channel composite credentials. -- */
284
285typedef struct {
286 grpc_channel_credentials base;
287 grpc_channel_credentials *inner_creds;
288 grpc_call_credentials *call_creds;
289} grpc_composite_channel_credentials;
290
Julien Boeufb037bb62015-07-08 14:58:14 -0700291/* -- Jwt credentials -- */
292
Craig Tillera82950e2015-09-22 12:33:20 -0700293typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700294 grpc_call_credentials base;
Julien Boeufb037bb62015-07-08 14:58:14 -0700295
296 /* Have a simple cache for now with just 1 entry. We could have a map based on
297 the service_url for a more sophisticated one. */
298 gpr_mu cache_mu;
Craig Tillera82950e2015-09-22 12:33:20 -0700299 struct {
Julien Boeufb037bb62015-07-08 14:58:14 -0700300 grpc_credentials_md_store *jwt_md;
301 char *service_url;
302 gpr_timespec jwt_expiration;
303 } cached;
304
305 grpc_auth_json_key key;
306 gpr_timespec jwt_lifetime;
Julien Boeuffe4c3f42015-07-22 16:20:13 -0700307} grpc_service_account_jwt_access_credentials;
Julien Boeufb037bb62015-07-08 14:58:14 -0700308
309/* -- Oauth2TokenFetcher credentials --
310
311 This object is a base for credentials that need to acquire an oauth2 token
312 from an http service. */
313
Craig Tillera82950e2015-09-22 12:33:20 -0700314typedef struct grpc_credentials_metadata_request
315 grpc_credentials_metadata_request;
Julien Boeufb037bb62015-07-08 14:58:14 -0700316
Craig Tillera82950e2015-09-22 12:33:20 -0700317typedef void (*grpc_fetch_oauth2_func)(grpc_exec_ctx *exec_ctx,
318 grpc_credentials_metadata_request *req,
319 grpc_httpcli_context *http_context,
320 grpc_pollset *pollset,
321 grpc_httpcli_response_cb response_cb,
322 gpr_timespec deadline);
Julien Boeufb037bb62015-07-08 14:58:14 -0700323
Craig Tillera82950e2015-09-22 12:33:20 -0700324typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700325 grpc_call_credentials base;
Julien Boeufb037bb62015-07-08 14:58:14 -0700326 gpr_mu mu;
327 grpc_credentials_md_store *access_token_md;
328 gpr_timespec token_expiration;
329 grpc_httpcli_context httpcli_context;
Julien Boeufb037bb62015-07-08 14:58:14 -0700330 grpc_fetch_oauth2_func fetch_func;
331} grpc_oauth2_token_fetcher_credentials;
332
Julien Boeuf510a9202015-08-25 21:51:07 -0700333/* -- GoogleRefreshToken credentials. -- */
Julien Boeufb037bb62015-07-08 14:58:14 -0700334
Craig Tillera82950e2015-09-22 12:33:20 -0700335typedef struct {
Julien Boeufb037bb62015-07-08 14:58:14 -0700336 grpc_oauth2_token_fetcher_credentials base;
337 grpc_auth_refresh_token refresh_token;
Julien Boeuf510a9202015-08-25 21:51:07 -0700338} grpc_google_refresh_token_credentials;
Julien Boeufb037bb62015-07-08 14:58:14 -0700339
Julien Boeuf0b1b1a52015-07-10 08:35:04 -0700340/* -- Oauth2 Access Token credentials. -- */
341
Craig Tillera82950e2015-09-22 12:33:20 -0700342typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700343 grpc_call_credentials base;
Julien Boeuf0b1b1a52015-07-10 08:35:04 -0700344 grpc_credentials_md_store *access_token_md;
345} grpc_access_token_credentials;
346
Julien Boeufea456fc2015-07-07 15:23:30 -0700347/* -- Metadata-only Test credentials. -- */
Julien Boeufb037bb62015-07-08 14:58:14 -0700348
Craig Tillera82950e2015-09-22 12:33:20 -0700349typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700350 grpc_call_credentials base;
Julien Boeufea456fc2015-07-07 15:23:30 -0700351 grpc_credentials_md_store *md_store;
Julien Boeufb037bb62015-07-08 14:58:14 -0700352 int is_async;
Julien Boeufea456fc2015-07-07 15:23:30 -0700353} grpc_md_only_test_credentials;
Julien Boeufb037bb62015-07-08 14:58:14 -0700354
Julien Boeuf510a9202015-08-25 21:51:07 -0700355/* -- GoogleIAM credentials. -- */
Julien Boeufb037bb62015-07-08 14:58:14 -0700356
Craig Tillera82950e2015-09-22 12:33:20 -0700357typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700358 grpc_call_credentials base;
Julien Boeufb037bb62015-07-08 14:58:14 -0700359 grpc_credentials_md_store *iam_md;
Julien Boeuf510a9202015-08-25 21:51:07 -0700360} grpc_google_iam_credentials;
Julien Boeufb037bb62015-07-08 14:58:14 -0700361
362/* -- Composite credentials. -- */
363
Craig Tillera82950e2015-09-22 12:33:20 -0700364typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700365 grpc_call_credentials base;
366 grpc_call_credentials_array inner;
Julien Boeufb73cbc22015-10-20 21:52:54 -0700367} grpc_composite_call_credentials;
Julien Boeufb037bb62015-07-08 14:58:14 -0700368
Julien Boeuf2d041182015-08-31 20:30:09 -0700369/* -- Plugin credentials. -- */
370
Craig Tillera82950e2015-09-22 12:33:20 -0700371typedef struct {
Julien Boeufacd835f2015-10-09 15:20:57 -0700372 grpc_call_credentials base;
Julien Boeuf2d041182015-08-31 20:30:09 -0700373 grpc_metadata_credentials_plugin plugin;
374 grpc_credentials_md_store *plugin_md;
375} grpc_plugin_credentials;
376
Craig Tiller9a4dddd2016-03-25 17:08:13 -0700377#endif /* GRPC_CORE_LIB_SECURITY_CREDENTIALS_H */