aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/lib/security/credentials
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-09-23 10:48:53 -0700
committerGravatar Craig Tiller <ctiller@google.com>2016-09-23 10:48:53 -0700
commit45881861dc6336b4387ebd894fa7193de475e594 (patch)
tree8a2f1c4a5ae2e9406b0fb705deb9f506e1ac8c6c /src/core/lib/security/credentials
parente34c285ac94892cb21bd6fa50d4ecdc49e85cd85 (diff)
Integration progress
Diffstat (limited to 'src/core/lib/security/credentials')
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_verifier.c14
-rw-r--r--src/core/lib/security/credentials/oauth2/oauth2_credentials.c18
2 files changed, 26 insertions, 6 deletions
diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.c b/src/core/lib/security/credentials/jwt/jwt_verifier.c
index 73eb2e3258..c1a3eb7eab 100644
--- a/src/core/lib/security/credentials/jwt/jwt_verifier.c
+++ b/src/core/lib/security/credentials/jwt/jwt_verifier.c
@@ -657,11 +657,16 @@ static void on_openid_config_retrieved(grpc_exec_ctx *exec_ctx, void *user_data,
*(req.host + (req.http.path - jwks_uri)) = '\0';
}
+ /* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host
+ channel. This would allow us to cancel an authentication query when under
+ extreme memory pressure. */
+ grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create();
grpc_httpcli_get(
- exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, &req,
+ exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, buffer_pool, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
grpc_closure_create(on_keys_retrieved, ctx),
&ctx->responses[HTTP_RESPONSE_KEYS]);
+ grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool);
grpc_json_destroy(json);
gpr_free(req.host);
return;
@@ -764,10 +769,15 @@ static void retrieve_key_and_verify(grpc_exec_ctx *exec_ctx,
rsp_idx = HTTP_RESPONSE_OPENID;
}
+ /* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host
+ channel. This would allow us to cancel an authentication query when under
+ extreme memory pressure. */
+ grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create();
grpc_httpcli_get(
- exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, &req,
+ exec_ctx, &ctx->verifier->http_ctx, &ctx->pollent, buffer_pool, &req,
gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), grpc_jwt_verifier_max_delay),
http_cb, &ctx->responses[rsp_idx]);
+ grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool);
gpr_free(req.host);
gpr_free(req.http.path);
return;
diff --git a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c
index c22ea5c468..e9e83d1468 100644
--- a/src/core/lib/security/credentials/oauth2/oauth2_credentials.c
+++ b/src/core/lib/security/credentials/oauth2/oauth2_credentials.c
@@ -307,9 +307,14 @@ static void compute_engine_fetch_oauth2(
request.http.path = GRPC_COMPUTE_ENGINE_METADATA_TOKEN_PATH;
request.http.hdr_count = 1;
request.http.hdrs = &header;
- grpc_httpcli_get(exec_ctx, httpcli_context, pollent, &request, deadline,
- grpc_closure_create(response_cb, metadata_req),
+ /* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host
+ channel. This would allow us to cancel an authentication query when under
+ extreme memory pressure. */
+ grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create();
+ grpc_httpcli_get(exec_ctx, httpcli_context, pollent, buffer_pool, &request,
+ deadline, grpc_closure_create(response_cb, metadata_req),
&metadata_req->response);
+ grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool);
}
grpc_call_credentials *grpc_google_compute_engine_credentials_create(
@@ -357,10 +362,15 @@ static void refresh_token_fetch_oauth2(
request.http.hdr_count = 1;
request.http.hdrs = &header;
request.handshaker = &grpc_httpcli_ssl;
- grpc_httpcli_post(exec_ctx, httpcli_context, pollent, &request, body,
- strlen(body), deadline,
+ /* TODO(ctiller): Carry the buffer_pool in ctx and share it with the host
+ channel. This would allow us to cancel an authentication query when under
+ extreme memory pressure. */
+ grpc_buffer_pool *buffer_pool = grpc_buffer_pool_create();
+ grpc_httpcli_post(exec_ctx, httpcli_context, pollent, buffer_pool, &request,
+ body, strlen(body), deadline,
grpc_closure_create(response_cb, metadata_req),
&metadata_req->response);
+ grpc_buffer_pool_internal_unref(exec_ctx, buffer_pool);
gpr_free(body);
}