aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar Julien Boeuf <jboeuf@google.com>2015-10-09 22:49:42 -0700
committerGravatar Julien Boeuf <jboeuf@google.com>2015-10-09 22:49:42 -0700
commit4e02e84062d81137496d00e6c5f895966aead92d (patch)
treebaf54f7e6e3923e0e9676cac0bc54ad42adb2e1e /src/core
parent441176d161f7c8e61b7724103e761d9076607223 (diff)
Got the core test passing.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/security/credentials.c28
-rw-r--r--src/core/security/credentials.h2
2 files changed, 24 insertions, 6 deletions
diff --git a/src/core/security/credentials.c b/src/core/security/credentials.c
index a1fa457d1a..ef1f40633b 100644
--- a/src/core/security/credentials.c
+++ b/src/core/security/credentials.c
@@ -116,7 +116,7 @@ void grpc_call_credentials_release(grpc_call_credentials *creds) {
grpc_call_credentials_unref(creds);
}
-void grpc_credentials_get_request_metadata(
+void grpc_call_credentials_get_request_metadata(
grpc_exec_ctx *exec_ctx, grpc_call_credentials *creds, grpc_pollset *pollset,
const char *service_url, grpc_credentials_metadata_cb cb, void *user_data) {
if (creds == NULL || creds->vtable->get_request_metadata == NULL) {
@@ -980,9 +980,9 @@ static void composite_metadata_cb(grpc_exec_ctx *exec_ctx, void *user_data,
if (ctx->creds_index < ctx->composite_creds->inner.num_creds) {
grpc_call_credentials *inner_creds =
ctx->composite_creds->inner.creds_array[ctx->creds_index++];
- grpc_credentials_get_request_metadata(exec_ctx, inner_creds, ctx->pollset,
- ctx->service_url,
- composite_metadata_cb, ctx);
+ grpc_call_credentials_get_request_metadata(exec_ctx, inner_creds,
+ ctx->pollset, ctx->service_url,
+ composite_metadata_cb, ctx);
return;
}
@@ -1006,7 +1006,7 @@ static void composite_get_request_metadata(
ctx->composite_creds = c;
ctx->pollset = pollset;
ctx->md_elems = grpc_credentials_md_store_create(c->inner.num_creds);
- grpc_credentials_get_request_metadata(
+ grpc_call_credentials_get_request_metadata(
exec_ctx, c->inner.creds_array[ctx->creds_index++], pollset, service_url,
composite_metadata_cb, ctx);
}
@@ -1092,6 +1092,24 @@ grpc_call_credentials *grpc_credentials_contains_type(
return NULL;
}
+grpc_channel_credentials *grpc_composite_channel_credentials_create(
+ grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds,
+ void *reserved) {
+ GPR_ASSERT(reserved == NULL);
+ if (channel_creds == NULL) return NULL;
+ if (channel_creds->call_creds == NULL) {
+ channel_creds->call_creds = grpc_call_credentials_ref(call_creds);
+ } else if (call_creds != NULL) {
+ grpc_call_credentials *composite_creds =
+ grpc_composite_call_credentials_create(channel_creds->call_creds,
+ call_creds, NULL);
+ if (composite_creds == NULL) return NULL;
+ grpc_call_credentials_unref(channel_creds->call_creds);
+ channel_creds->call_creds = composite_creds;
+ }
+ return grpc_channel_credentials_ref(channel_creds);
+}
+
/* -- IAM credentials. -- */
static void iam_destruct(grpc_call_credentials *creds) {
diff --git a/src/core/security/credentials.h b/src/core/security/credentials.h
index 1218983e7b..b507e2b178 100644
--- a/src/core/security/credentials.h
+++ b/src/core/security/credentials.h
@@ -64,7 +64,7 @@ typedef enum {
#define GRPC_CALL_CREDENTIALS_TYPE_IAM "Iam"
#define GRPC_CALL_CREDENTIALS_TYPE_COMPOSITE "Composite"
-#define GRPC_AUTHORIZATION_METADATA_KEY "Authorization"
+#define GRPC_AUTHORIZATION_METADATA_KEY "authorization"
#define GRPC_IAM_AUTHORIZATION_TOKEN_METADATA_KEY \
"x-goog-iam-authorization-token"
#define GRPC_IAM_AUTHORITY_SELECTOR_METADATA_KEY "x-goog-iam-authority-selector"