json_token_test.cc
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
20 
21 #include <string.h>
22 
23 #include <openssl/evp.h>
24 
25 #include <grpc/grpc_security.h>
26 #include <grpc/slice.h>
27 #include <grpc/support/alloc.h>
28 #include <grpc/support/log.h>
29 
30 #include "src/core/lib/json/json.h"
32 #include "src/core/lib/slice/b64.h"
35 
36 using grpc_core::Json;
37 
38 /* This JSON key was generated with the GCE console and revoked immediately.
39  The identifiers have been changed as well.
40  Maximum size for a string literal is 509 chars in C89, yay! */
41 static const char test_json_key_str_part1[] =
42  "{ \"private_key\": \"-----BEGIN PRIVATE KEY-----"
43  "\\nMIICeAIBADANBgkqhkiG9w0BAQEFAASCAmIwggJeAgEAAoGBAOEvJsnoHnyHkXcp\\n7mJE"
44  "qg"
45  "WGjiw71NfXByguekSKho65FxaGbsnSM9SMQAqVk7Q2rG+I0OpsT0LrWQtZ\\nyjSeg/"
46  "rWBQvS4hle4LfijkP3J5BG+"
47  "IXDMP8RfziNRQsenAXDNPkY4kJCvKux2xdD\\nOnVF6N7dL3nTYZg+"
48  "uQrNsMTz9UxVAgMBAAECgYEAzbLewe1xe9vy+2GoSsfib+28\\nDZgSE6Bu/"
49  "zuFoPrRc6qL9p2SsnV7txrunTyJkkOnPLND9ABAXybRTlcVKP/sGgza\\n/"
50  "8HpCqFYM9V8f34SBWfD4fRFT+n/"
51  "73cfRUtGXdXpseva2lh8RilIQfPhNZAncenU\\ngqXjDvpkypEusgXAykECQQD+";
52 static const char test_json_key_str_part2[] =
53  "53XxNVnxBHsYb+AYEfklR96yVi8HywjVHP34+OQZ\\nCslxoHQM8s+"
54  "dBnjfScLu22JqkPv04xyxmt0QAKm9+vTdAkEA4ib7YvEAn2jXzcCI\\nEkoy2L/"
55  "XydR1GCHoacdfdAwiL2npOdnbvi4ZmdYRPY1LSTO058tQHKVXV7NLeCa3\\nAARh2QJBAMKeDA"
56  "G"
57  "W303SQv2cZTdbeaLKJbB5drz3eo3j7dDKjrTD9JupixFbzcGw\\n8FZi5c8idxiwC36kbAL6Hz"
58  "A"
59  "ZoX+ofI0CQE6KCzPJTtYNqyShgKAZdJ8hwOcvCZtf\\n6z8RJm0+"
60  "6YBd38lfh5j8mZd7aHFf6I17j5AQY7oPEc47TjJj/"
61  "5nZ68ECQQDvYuI3\\nLyK5fS8g0SYbmPOL9TlcHDOqwG0mrX9qpg5DC2fniXNSrrZ64GTDKdzZ"
62  "Y"
63  "Ap6LI9W\\nIqv4vr6y38N79TTC\\n-----END PRIVATE KEY-----\\n\", ";
64 static const char test_json_key_str_part3[] =
65  "\"private_key_id\": \"e6b5137873db8d2ef81e06a47289e6434ec8a165\", "
66  "\"client_email\": "
67  "\"777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount."
68  "com\", \"client_id\": "
69  "\"777-abaslkan11hlb6nmim3bpspl31ud.apps.googleusercontent."
70  "com\", \"type\": \"service_account\" }";
71 
72 /* Test refresh token. */
73 static const char test_refresh_token_str[] =
74  "{ \"client_id\": \"32555999999.apps.googleusercontent.com\","
75  " \"client_secret\": \"EmssLNjJy1332hD4KFsecret\","
76  " \"refresh_token\": \"1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42\","
77  " \"type\": \"authorized_user\"}";
78 
79 static const char test_scope[] = "myperm1 myperm2";
80 
81 static const char test_service_url[] = "https://foo.com/foo.v1";
82 
83 static char* test_json_key_str(const char* bad_part3) {
84  const char* part3 =
85  bad_part3 != nullptr ? bad_part3 : test_json_key_str_part3;
86  size_t result_len = strlen(test_json_key_str_part1) +
87  strlen(test_json_key_str_part2) + strlen(part3);
88  char* result = static_cast<char*>(gpr_malloc(result_len + 1));
89  char* current = result;
91  current += strlen(test_json_key_str_part1);
92  strcpy(current, test_json_key_str_part2);
93  current += strlen(test_json_key_str_part2);
94  strcpy(current, part3);
95  return result;
96 }
97 
98 static void test_parse_json_key_success(void) {
99  char* json_string = test_json_key_str(nullptr);
100  grpc_auth_json_key json_key =
103  GPR_ASSERT(json_key.type != nullptr &&
104  strcmp(json_key.type, "service_account") == 0);
105  GPR_ASSERT(json_key.private_key_id != nullptr &&
106  strcmp(json_key.private_key_id,
107  "e6b5137873db8d2ef81e06a47289e6434ec8a165") == 0);
108  GPR_ASSERT(json_key.client_id != nullptr &&
109  strcmp(json_key.client_id,
110  "777-abaslkan11hlb6nmim3bpspl31ud.apps."
111  "googleusercontent.com") == 0);
112  GPR_ASSERT(json_key.client_email != nullptr &&
113  strcmp(json_key.client_email,
114  "777-abaslkan11hlb6nmim3bpspl31ud@developer."
115  "gserviceaccount.com") == 0);
116  GPR_ASSERT(json_key.private_key != nullptr);
117  gpr_free(json_string);
118  grpc_auth_json_key_destruct(&json_key);
119 }
120 
122  const char non_closing_part3[] =
123  "\"private_key_id\": \"e6b5137873db8d2ef81e06a47289e6434ec8a165\", "
124  "\"client_email\": "
125  "\"777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount."
126  "com\", \"client_id\": "
127  "\"777-abaslkan11hlb6nmim3bpspl31ud.apps.googleusercontent."
128  "com\", \"type\": \"service_account\" ";
129  char* json_string = test_json_key_str(non_closing_part3);
130  grpc_auth_json_key json_key =
133  gpr_free(json_string);
134  grpc_auth_json_key_destruct(&json_key);
135 }
136 
138  const char no_type_part3[] =
139  "\"private_key_id\": \"e6b5137873db8d2ef81e06a47289e6434ec8a165\", "
140  "\"client_email\": "
141  "\"777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount."
142  "com\", \"client_id\": "
143  "\"777-abaslkan11hlb6nmim3bpspl31ud.apps.googleusercontent."
144  "com\" }";
145  char* json_string = test_json_key_str(no_type_part3);
146  grpc_auth_json_key json_key =
149  gpr_free(json_string);
150  grpc_auth_json_key_destruct(&json_key);
151 }
152 
154  const char no_client_id_part3[] =
155  "\"private_key_id\": \"e6b5137873db8d2ef81e06a47289e6434ec8a165\", "
156  "\"client_email\": "
157  "\"777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount."
158  "com\", "
159  "\"type\": \"service_account\" }";
160  char* json_string = test_json_key_str(no_client_id_part3);
161  grpc_auth_json_key json_key =
164  gpr_free(json_string);
165  grpc_auth_json_key_destruct(&json_key);
166 }
167 
169  const char no_client_email_part3[] =
170  "\"private_key_id\": \"e6b5137873db8d2ef81e06a47289e6434ec8a165\", "
171  "\"client_id\": "
172  "\"777-abaslkan11hlb6nmim3bpspl31ud.apps.googleusercontent."
173  "com\", \"type\": \"service_account\" }";
174  char* json_string = test_json_key_str(no_client_email_part3);
175  grpc_auth_json_key json_key =
178  gpr_free(json_string);
179  grpc_auth_json_key_destruct(&json_key);
180 }
181 
183  const char no_private_key_id_part3[] =
184  "\"client_email\": "
185  "\"777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount."
186  "com\", \"client_id\": "
187  "\"777-abaslkan11hlb6nmim3bpspl31ud.apps.googleusercontent."
188  "com\", \"type\": \"service_account\" }";
189  char* json_string = test_json_key_str(no_private_key_id_part3);
190  grpc_auth_json_key json_key =
193  gpr_free(json_string);
194  grpc_auth_json_key_destruct(&json_key);
195 }
196 
198  const char no_private_key_json_string[] =
199  "{ \"private_key_id\": \"e6b5137873db8d2ef81e06a47289e6434ec8a165\", "
200  "\"client_email\": "
201  "\"777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount."
202  "com\", \"client_id\": "
203  "\"777-abaslkan11hlb6nmim3bpspl31ud.apps.googleusercontent."
204  "com\", \"type\": \"service_account\" }";
205  grpc_auth_json_key json_key =
206  grpc_auth_json_key_create_from_string(no_private_key_json_string);
208  grpc_auth_json_key_destruct(&json_key);
209 }
210 
211 static Json parse_json_part_from_jwt(const char* str, size_t len) {
213  char* b64 = static_cast<char*>(gpr_malloc(len + 1));
214  strncpy(b64, str, len);
215  b64[len] = '\0';
217  gpr_free(b64);
221  Json json = Json::Parse(string, &error);
222  if (!GRPC_ERROR_IS_NONE(error)) {
223  gpr_log(GPR_ERROR, "JSON parse error: %s",
226  }
228  return json;
229 }
230 
231 static void check_jwt_header(const Json& header) {
232  Json::Object object = header.object_value();
233  Json value = object["alg"];
234  GPR_ASSERT(value.type() == Json::Type::STRING);
235  GPR_ASSERT(strcmp(value.string_value().c_str(), "RS256") == 0);
236  value = object["typ"];
237  GPR_ASSERT(value.type() == Json::Type::STRING);
238  GPR_ASSERT(strcmp(value.string_value().c_str(), "JWT") == 0);
239  value = object["kid"];
240  GPR_ASSERT(value.type() == Json::Type::STRING);
241  GPR_ASSERT(strcmp(value.string_value().c_str(),
242  "e6b5137873db8d2ef81e06a47289e6434ec8a165") == 0);
243 }
244 
245 static void check_jwt_claim(const Json& claim, const char* expected_audience,
246  const char* expected_scope) {
247  Json::Object object = claim.object_value();
248 
249  Json value = object["iss"];
250  GPR_ASSERT(value.type() == Json::Type::STRING);
251  GPR_ASSERT(value.string_value() ==
252  "777-abaslkan11hlb6nmim3bpspl31ud@developer.gserviceaccount.com");
253 
254  if (expected_scope != nullptr) {
255  GPR_ASSERT(object.find("sub") == object.end());
256  value = object["scope"];
257  GPR_ASSERT(value.type() == Json::Type::STRING);
258  GPR_ASSERT(value.string_value() == expected_scope);
259  } else {
260  /* Claims without scope must have a sub. */
261  GPR_ASSERT(object.find("scope") == object.end());
262  value = object["sub"];
263  GPR_ASSERT(value.type() == Json::Type::STRING);
264  GPR_ASSERT(value.string_value() == object["iss"].string_value());
265  }
266 
267  value = object["aud"];
268  GPR_ASSERT(value.type() == Json::Type::STRING);
269  GPR_ASSERT(value.string_value() == expected_audience);
270 
272  value = object["exp"];
273  GPR_ASSERT(value.type() == Json::Type::NUMBER);
274  expiration.tv_sec = strtol(value.string_value().c_str(), nullptr, 10);
275 
277  value = object["iat"];
278  GPR_ASSERT(value.type() == Json::Type::NUMBER);
279  issue_time.tv_sec = strtol(value.string_value().c_str(), nullptr, 10);
280 
281  gpr_timespec parsed_lifetime = gpr_time_sub(expiration, issue_time);
282  GPR_ASSERT(parsed_lifetime.tv_sec == grpc_max_auth_token_lifetime().tv_sec);
283 }
284 
285 static void check_jwt_signature(const char* b64_signature, RSA* rsa_key,
286  const char* signed_data,
287  size_t signed_data_size) {
289 
290  EVP_MD_CTX* md_ctx = EVP_MD_CTX_create();
292 
293  grpc_slice sig = grpc_base64_decode(b64_signature, 1);
295  GPR_ASSERT(GRPC_SLICE_LENGTH(sig) == 128);
296 
297  GPR_ASSERT(md_ctx != nullptr);
298  GPR_ASSERT(key != nullptr);
299  EVP_PKEY_set1_RSA(key, rsa_key);
300 
301  GPR_ASSERT(
302  EVP_DigestVerifyInit(md_ctx, nullptr, EVP_sha256(), nullptr, key) == 1);
303  GPR_ASSERT(EVP_DigestVerifyUpdate(md_ctx, signed_data, signed_data_size) ==
304  1);
306  GRPC_SLICE_LENGTH(sig)) == 1);
307 
309  if (key != nullptr) EVP_PKEY_free(key);
310  if (md_ctx != nullptr) EVP_MD_CTX_destroy(md_ctx);
311 }
312 
314  const grpc_auth_json_key* key) {
317 }
318 
321  grpc_max_auth_token_lifetime(), nullptr);
322 }
323 
324 static void service_account_creds_check_jwt_claim(const Json& claim) {
326 }
327 
328 static void jwt_creds_check_jwt_claim(const Json& claim) {
329  check_jwt_claim(claim, test_service_url, nullptr);
330 }
331 
333  char* (*jwt_encode_and_sign_func)(const grpc_auth_json_key*),
334  void (*check_jwt_claim_func)(const Json&)) {
335  char* json_string = test_json_key_str(nullptr);
336  grpc_auth_json_key json_key =
338  const char* b64_signature;
339  size_t offset = 0;
340  char* jwt = jwt_encode_and_sign_func(&json_key);
341  const char* dot = strchr(jwt, '.');
342  GPR_ASSERT(dot != nullptr);
343  Json parsed_header =
344  parse_json_part_from_jwt(jwt, static_cast<size_t>(dot - jwt));
345  GPR_ASSERT(parsed_header.type() == Json::Type::OBJECT);
346  check_jwt_header(parsed_header);
347  offset = static_cast<size_t>(dot - jwt) + 1;
348 
349  dot = strchr(jwt + offset, '.');
350  GPR_ASSERT(dot != nullptr);
351  Json parsed_claim = parse_json_part_from_jwt(
352  jwt + offset, static_cast<size_t>(dot - (jwt + offset)));
353  GPR_ASSERT(parsed_claim.type() == Json::Type::OBJECT);
354  check_jwt_claim_func(parsed_claim);
355  offset = static_cast<size_t>(dot - jwt) + 1;
356 
357  dot = strchr(jwt + offset, '.');
358  GPR_ASSERT(dot == nullptr); /* no more part. */
359  b64_signature = jwt + offset;
360  check_jwt_signature(b64_signature, json_key.private_key, jwt, offset - 1);
361 
362  gpr_free(json_string);
363  grpc_auth_json_key_destruct(&json_key);
364  gpr_free(jwt);
365 }
366 
370 }
371 
375 }
376 
378  grpc_auth_refresh_token refresh_token =
381  GPR_ASSERT(refresh_token.type != nullptr &&
382  (strcmp(refresh_token.type, "authorized_user") == 0));
383  GPR_ASSERT(refresh_token.client_id != nullptr &&
384  (strcmp(refresh_token.client_id,
385  "32555999999.apps.googleusercontent.com") == 0));
386  GPR_ASSERT(
387  refresh_token.client_secret != nullptr &&
388  (strcmp(refresh_token.client_secret, "EmssLNjJy1332hD4KFsecret") == 0));
389  GPR_ASSERT(refresh_token.refresh_token != nullptr &&
390  (strcmp(refresh_token.refresh_token,
391  "1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42") == 0));
392  grpc_auth_refresh_token_destruct(&refresh_token);
393 }
394 
396  const char refresh_token_str[] =
397  "{ \"client_id\": \"32555999999.apps.googleusercontent.com\","
398  " \"client_secret\": \"EmssLNjJy1332hD4KFsecret\","
399  " \"refresh_token\": \"1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42\"}";
400  grpc_auth_refresh_token refresh_token =
403 }
404 
406  const char refresh_token_str[] =
407  "{ \"client_secret\": \"EmssLNjJy1332hD4KFsecret\","
408  " \"refresh_token\": \"1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42\","
409  " \"type\": \"authorized_user\"}";
410  grpc_auth_refresh_token refresh_token =
413 }
414 
416  const char refresh_token_str[] =
417  "{ \"client_id\": \"32555999999.apps.googleusercontent.com\","
418  " \"refresh_token\": \"1/Blahblasj424jladJDSGNf-u4Sua3HDA2ngjd42\","
419  " \"type\": \"authorized_user\"}";
420  grpc_auth_refresh_token refresh_token =
423 }
424 
426  const char refresh_token_str[] =
427  "{ \"client_id\": \"32555999999.apps.googleusercontent.com\","
428  " \"client_secret\": \"EmssLNjJy1332hD4KFsecret\","
429  " \"type\": \"authorized_user\"}";
430  grpc_auth_refresh_token refresh_token =
433 }
434 
435 int main(int argc, char** argv) {
436  grpc::testing::TestEnvironment env(&argc, argv);
437  grpc_init();
452  grpc_shutdown();
453  return 0;
454 }
xds_interop_client.str
str
Definition: xds_interop_client.py:487
test_parse_json_key_failure_bad_json
static void test_parse_json_key_failure_bad_json(void)
Definition: json_token_test.cc:121
grpc_slice_unref
GPRAPI void grpc_slice_unref(grpc_slice s)
Definition: slice_api.cc:32
_gevent_test_main.result
result
Definition: _gevent_test_main.py:96
gpr_timespec::tv_sec
int64_t tv_sec
Definition: gpr_types.h:51
cleanup.Json
Json
Definition: cleanup.py:49
EVP_PKEY_new
#define EVP_PKEY_new
Definition: boringssl_prefix_symbols.h:1643
test_scope
static const char test_scope[]
Definition: json_token_test.cc:79
service_account_creds_jwt_encode_and_sign
static char * service_account_creds_jwt_encode_and_sign(const grpc_auth_json_key *key)
Definition: json_token_test.cc:313
GRPC_ERROR_NONE
#define GRPC_ERROR_NONE
Definition: error.h:234
log.h
EVP_DigestVerifyInit
#define EVP_DigestVerifyInit
Definition: boringssl_prefix_symbols.h:1519
grpc_core::Json::type
Type type() const
Definition: src/core/lib/json/json.h:174
generate.env
env
Definition: generate.py:37
test_parse_json_key_failure_no_client_id
static void test_parse_json_key_failure_no_client_id(void)
Definition: json_token_test.cc:153
find
static void ** find(grpc_chttp2_stream_map *map, uint32_t key)
Definition: stream_map.cc:99
grpc_auth_refresh_token::client_id
char * client_id
Definition: oauth2_credentials.h:62
evp.h
slice.h
grpc_auth_refresh_token::type
const char * type
Definition: oauth2_credentials.h:61
parse_json_part_from_jwt
static Json parse_json_part_from_jwt(const char *str, size_t len)
Definition: json_token_test.cc:211
gpr_time_0
GPRAPI gpr_timespec gpr_time_0(gpr_clock_type type)
Definition: src/core/lib/gpr/time.cc:47
grpc_auth_refresh_token::client_secret
char * client_secret
Definition: oauth2_credentials.h:63
main
int main(int argc, char **argv)
Definition: json_token_test.cc:435
string.h
absl::string_view
Definition: abseil-cpp/absl/strings/string_view.h:167
grpc_core::StringViewFromSlice
absl::string_view StringViewFromSlice(const grpc_slice &slice)
Definition: slice_internal.h:93
grpc_jwt_encode_and_sign
char * grpc_jwt_encode_and_sign(const grpc_auth_json_key *json_key, const char *audience, gpr_timespec token_lifetime, const char *scope)
Definition: json_token.cc:266
gpr_free
GPRAPI void gpr_free(void *ptr)
Definition: alloc.cc:51
error
grpc_error_handle error
Definition: retry_filter.cc:499
grpc_core::Json::object_value
const Object & object_value() const
Definition: src/core/lib/json/json.h:177
test_service_account_creds_jwt_encode_and_sign
static void test_service_account_creds_jwt_encode_and_sign(void)
Definition: json_token_test.cc:367
gpr_malloc
GPRAPI void * gpr_malloc(size_t size)
Definition: alloc.cc:29
EVP_DigestVerifyUpdate
#define EVP_DigestVerifyUpdate
Definition: boringssl_prefix_symbols.h:1520
json_token.h
grpc_security.h
check_jwt_signature
static void check_jwt_signature(const char *b64_signature, RSA *rsa_key, const char *signed_data, size_t signed_data_size)
Definition: json_token_test.cc:285
grpc_auth_json_key_destruct
void grpc_auth_json_key_destruct(grpc_auth_json_key *json_key)
Definition: json_token.cc:134
grpc_auth_refresh_token
Definition: oauth2_credentials.h:60
EVP_sha256
const OPENSSL_EXPORT EVP_MD * EVP_sha256(void)
check_jwt_header
static void check_jwt_header(const Json &header)
Definition: json_token_test.cc:231
grpc_auth_refresh_token_destruct
void grpc_auth_refresh_token_destruct(grpc_auth_refresh_token *refresh_token)
Destructs the object.
Definition: oauth2_credentials.cc:127
grpc_auth_json_key_create_from_string
grpc_auth_json_key grpc_auth_json_key_create_from_string(const char *json_string)
Definition: json_token.cc:126
check_jwt_claim
static void check_jwt_claim(const Json &claim, const char *expected_audience, const char *expected_scope)
Definition: json_token_test.cc:245
env_md_ctx_st
Definition: digest.h:306
evp_pkey_st
Definition: evp.h:1046
GPR_ASSERT
#define GPR_ASSERT(x)
Definition: include/grpc/impl/codegen/log.h:94
end
char * end
Definition: abseil-cpp/absl/strings/internal/str_format/float_conversion.cc:1008
grpc_auth_json_key_is_valid
int grpc_auth_json_key_is_valid(const grpc_auth_json_key *json_key)
Definition: json_token.cc:66
test_parse_refresh_token_failure_no_client_id
static void test_parse_refresh_token_failure_no_client_id(void)
Definition: json_token_test.cc:405
gen_stats_data.c_str
def c_str(s, encoding='ascii')
Definition: gen_stats_data.py:38
test_json_key_str
static char * test_json_key_str(const char *bad_part3)
Definition: json_token_test.cc:83
Json
JSON (JavaScript Object Notation).
Definition: third_party/bloaty/third_party/protobuf/conformance/third_party/jsoncpp/json.h:227
test_parse_json_key_failure_no_client_email
static void test_parse_json_key_failure_no_client_email(void)
Definition: json_token_test.cc:168
grpc_auth_json_key::type
const char * type
Definition: json_token.h:37
GRPC_SLICE_IS_EMPTY
#define GRPC_SLICE_IS_EMPTY(slice)
Definition: include/grpc/impl/codegen/slice.h:112
gpr_time_sub
GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b)
Definition: src/core/lib/gpr/time.cc:168
grpc_base64_decode
grpc_slice grpc_base64_decode(const char *b64, int url_safe)
Definition: b64.cc:126
grpc_max_auth_token_lifetime
GRPCAPI gpr_timespec grpc_max_auth_token_lifetime(void)
Definition: json_token.cc:48
slice
grpc_slice slice
Definition: src/core/lib/surface/server.cc:467
gpr_log
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
grpc_auth_refresh_token_create_from_string
grpc_auth_refresh_token grpc_auth_refresh_token_create_from_string(const char *json_string)
Definition: oauth2_credentials.cc:115
test_parse_json_key_failure_no_private_key
static void test_parse_json_key_failure_no_private_key(void)
Definition: json_token_test.cc:197
grpc_auth_json_key::private_key_id
char * private_key_id
Definition: json_token.h:38
EVP_PKEY_free
#define EVP_PKEY_free
Definition: boringssl_prefix_symbols.h:1625
header
struct absl::base_internal::@2940::AllocList::Header header
GRPC_SLICE_START_PTR
#define GRPC_SLICE_START_PTR(slice)
Definition: include/grpc/impl/codegen/slice.h:101
b64.h
grpc_slice
Definition: include/grpc/impl/codegen/slice.h:65
test_parse_refresh_token_failure_no_type
static void test_parse_refresh_token_failure_no_type(void)
Definition: json_token_test.cc:395
absl::flags_internal::Parse
bool Parse(FlagOpFn op, absl::string_view text, void *dst, std::string *error)
Definition: abseil-cpp/absl/flags/internal/flag.h:125
json.h
slice_internal.h
GPR_ERROR
#define GPR_ERROR
Definition: include/grpc/impl/codegen/log.h:57
test_parse_refresh_token_failure_no_refresh_token
static void test_parse_refresh_token_failure_no_refresh_token(void)
Definition: json_token_test.cc:425
grpc_core::ExecCtx
Definition: exec_ctx.h:97
test_json_key_str_part1
static const char test_json_key_str_part1[]
Definition: json_token_test.cc:41
grpc_auth_json_key::private_key
RSA * private_key
Definition: json_token.h:41
grpc_auth_refresh_token::refresh_token
char * refresh_token
Definition: oauth2_credentials.h:64
GRPC_SLICE_LENGTH
#define GRPC_SLICE_LENGTH(slice)
Definition: include/grpc/impl/codegen/slice.h:104
test_config.h
value
const char * value
Definition: hpack_parser_table.cc:165
test_jwt_creds_jwt_encode_and_sign
static void test_jwt_creds_jwt_encode_and_sign(void)
Definition: json_token_test.cc:372
test_json_key_str_part2
static const char test_json_key_str_part2[]
Definition: json_token_test.cc:52
EVP_PKEY_set1_RSA
#define EVP_PKEY_set1_RSA
Definition: boringssl_prefix_symbols.h:1653
EVP_MD_CTX_destroy
#define EVP_MD_CTX_destroy
Definition: boringssl_prefix_symbols.h:1565
test_service_url
static const char test_service_url[]
Definition: json_token_test.cc:81
key
const char * key
Definition: hpack_parser_table.cc:164
test_parse_json_key_failure_no_type
static void test_parse_json_key_failure_no_type(void)
Definition: json_token_test.cc:137
exec_ctx
grpc_core::ExecCtx exec_ctx
Definition: end2end_binder_transport_test.cc:75
grpc_error_std_string
std::string grpc_error_std_string(grpc_error_handle error)
Definition: error.cc:944
test_parse_refresh_token_success
static void test_parse_refresh_token_success(void)
Definition: json_token_test.cc:377
alloc.h
grpc::testing::TestEnvironment
Definition: test/core/util/test_config.h:54
test_refresh_token_str
static const char test_refresh_token_str[]
Definition: json_token_test.cc:73
GRPC_ERROR_UNREF
#define GRPC_ERROR_UNREF(err)
Definition: error.h:262
expected_audience
static const char expected_audience[]
Definition: jwt_verifier_test.cc:125
test_parse_json_key_success
static void test_parse_json_key_success(void)
Definition: json_token_test.cc:98
jwt_creds_check_jwt_claim
static void jwt_creds_check_jwt_claim(const Json &claim)
Definition: json_token_test.cc:328
test_jwt_encode_and_sign
static void test_jwt_encode_and_sign(char *(*jwt_encode_and_sign_func)(const grpc_auth_json_key *), void(*check_jwt_claim_func)(const Json &))
Definition: json_token_test.cc:332
service_account_creds_check_jwt_claim
static void service_account_creds_check_jwt_claim(const Json &claim)
Definition: json_token_test.cc:324
jwt_creds_jwt_encode_and_sign
static char * jwt_creds_jwt_encode_and_sign(const grpc_auth_json_key *key)
Definition: json_token_test.cc:319
test_parse_refresh_token_failure_no_client_secret
static void test_parse_refresh_token_failure_no_client_secret(void)
Definition: json_token_test.cc:415
GRPC_JWT_OAUTH2_AUDIENCE
#define GRPC_JWT_OAUTH2_AUDIENCE
Definition: json_token.h:32
rsa_st
Definition: rsa.h:732
len
int len
Definition: abseil-cpp/absl/base/internal/low_level_alloc_test.cc:46
gpr_timespec
Definition: gpr_types.h:50
grpc_init
GRPCAPI void grpc_init(void)
Definition: init.cc:146
grpc_error
Definition: error_internal.h:42
EVP_DigestVerifyFinal
#define EVP_DigestVerifyFinal
Definition: boringssl_prefix_symbols.h:1518
EVP_MD_CTX_create
#define EVP_MD_CTX_create
Definition: boringssl_prefix_symbols.h:1564
oauth2_credentials.h
GPR_CLOCK_REALTIME
@ GPR_CLOCK_REALTIME
Definition: gpr_types.h:39
grpc_auth_json_key::client_email
char * client_email
Definition: json_token.h:40
test_parse_json_key_failure_no_private_key_id
static void test_parse_json_key_failure_no_private_key_id(void)
Definition: json_token_test.cc:182
grpc_auth_json_key::client_id
char * client_id
Definition: json_token.h:39
grpc_shutdown
GRPCAPI void grpc_shutdown(void)
Definition: init.cc:209
grpc_auth_refresh_token_is_valid
int grpc_auth_refresh_token_is_valid(const grpc_auth_refresh_token *refresh_token)
Returns 1 if the object is valid, 0 otherwise.
Definition: oauth2_credentials.cc:73
offset
voidpf uLong offset
Definition: bloaty/third_party/zlib/contrib/minizip/ioapi.h:142
grpc_slice_unref_internal
void grpc_slice_unref_internal(const grpc_slice &slice)
Definition: slice_refcount.h:39
test_json_key_str_part3
static const char test_json_key_str_part3[]
Definition: json_token_test.cc:64
GRPC_ERROR_IS_NONE
#define GRPC_ERROR_IS_NONE(err)
Definition: error.h:241
grpc_auth_json_key
Definition: json_token.h:36


grpc
Author(s):
autogenerated on Thu Mar 13 2025 03:00:25