MCPcopy Create free account
hub / github.com/apache/impala / TEST

Function TEST

be/src/util/jwt-util-test.cc:527–547  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

525}
526
527TEST(JwtUtilTest, LoadJwksFile) {
528 // Load JWKS from file.
529 TempTestDataFile jwks_file(Substitute(jwks_rsa_file_format, kid_1, "RS256",
530 rsa_pub_key_jwk_n, rsa_pub_key_jwk_e, kid_2, "RS256", rsa_invalid_pub_key_jwk_n,
531 rsa_pub_key_jwk_e));
532 JWTHelper jwt_helper;
533 Status status = jwt_helper.Init(jwks_file.Filename());
534 EXPECT_OK(status);
535 JWKSSnapshotPtr jwks = jwt_helper.GetJWKS();
536 ASSERT_FALSE(jwks->IsEmpty());
537 ASSERT_EQ(2, jwks->GetRSAPublicKeyNum());
538
539 const JWTPublicKey* key1 = jwks->LookupRSAPublicKey(kid_1);
540 ASSERT_TRUE(key1 != nullptr);
541 ASSERT_EQ("rs256", key1->get_algorithm());
542 ASSERT_EQ(rsa_pub_key_pem, key1->get_key());
543
544 std::string non_existing_kid("public:c424b67b-fe28-45d7-b015-f79da5-xxxxx");
545 const JWTPublicKey* key3 = jwks->LookupRSAPublicKey(non_existing_kid);
546 ASSERT_FALSE(key3 != nullptr);
547}
548
549TEST(JwtUtilTest, LoadInvalidJwksFiles) {
550 // JWK without kid.

Callers

nothing calls this directly

Calls 15

SubstituteFunction · 0.85
createFunction · 0.85
CreateJwtX5cTokenFunction · 0.85
GetDetailMethod · 0.80
signMethod · 0.80
resetMethod · 0.65
getMethod · 0.65
InitMethod · 0.45
GetJWKSMethod · 0.45
IsEmptyMethod · 0.45
GetRSAPublicKeyNumMethod · 0.45
LookupRSAPublicKeyMethod · 0.45

Tested by

no test coverage detected