|
|
|
@ -56,12 +56,12 @@ grpc_call_error grpc_call_set_credentials(grpc_call* call, |
|
|
|
|
LOG(ERROR) << "Method is client-side only."; |
|
|
|
|
return GRPC_CALL_ERROR_NOT_ON_SERVER; |
|
|
|
|
} |
|
|
|
|
ctx = static_cast<grpc_client_security_context*>( |
|
|
|
|
grpc_call_context_get(call, GRPC_CONTEXT_SECURITY)); |
|
|
|
|
auto* arena = grpc_call_get_arena(call); |
|
|
|
|
ctx = grpc_core::DownCast<grpc_client_security_context*>( |
|
|
|
|
arena->GetContext<grpc_core::SecurityContext>()); |
|
|
|
|
if (ctx == nullptr) { |
|
|
|
|
ctx = grpc_client_security_context_create(grpc_call_get_arena(call), creds); |
|
|
|
|
grpc_call_context_set(call, GRPC_CONTEXT_SECURITY, ctx, |
|
|
|
|
grpc_client_security_context_destroy); |
|
|
|
|
ctx = grpc_client_security_context_create(arena, creds); |
|
|
|
|
arena->SetContext<grpc_core::SecurityContext>(ctx); |
|
|
|
|
} else { |
|
|
|
|
ctx->creds = creds != nullptr ? creds->Ref() : nullptr; |
|
|
|
|
} |
|
|
|
@ -70,11 +70,12 @@ grpc_call_error grpc_call_set_credentials(grpc_call* call, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
grpc_auth_context* grpc_call_auth_context(grpc_call* call) { |
|
|
|
|
void* sec_ctx = grpc_call_context_get(call, GRPC_CONTEXT_SECURITY); |
|
|
|
|
auto* sec_ctx = |
|
|
|
|
grpc_call_get_arena(call)->GetContext<grpc_core::SecurityContext>(); |
|
|
|
|
GRPC_API_TRACE("grpc_call_auth_context(call=%p)", 1, (call)); |
|
|
|
|
if (sec_ctx == nullptr) return nullptr; |
|
|
|
|
if (grpc_call_is_client(call)) { |
|
|
|
|
auto* sc = static_cast<grpc_client_security_context*>(sec_ctx); |
|
|
|
|
auto* sc = grpc_core::DownCast<grpc_client_security_context*>(sec_ctx); |
|
|
|
|
if (sc->auth_context == nullptr) { |
|
|
|
|
return nullptr; |
|
|
|
|
} else { |
|
|
|
@ -83,7 +84,7 @@ grpc_auth_context* grpc_call_auth_context(grpc_call* call) { |
|
|
|
|
.release(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
auto* sc = static_cast<grpc_server_security_context*>(sec_ctx); |
|
|
|
|
auto* sc = grpc_core::DownCast<grpc_server_security_context*>(sec_ctx); |
|
|
|
|
if (sc->auth_context == nullptr) { |
|
|
|
|
return nullptr; |
|
|
|
|
} else { |
|
|
|
|