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

Method UpdateJWKSThread

be/src/kudu/util/jwt-util.cc:751–778  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751void JWKSMgr::UpdateJWKSThread() {
752 std::shared_ptr<JWKSSnapshot> new_jwks;
753 const MonoDelta &timeout = MonoDelta::FromSeconds(FLAGS_jwks_update_frequency_s);
754
755 while (true) {
756 if (shut_down_promise_.WaitFor(timeout) != nullptr) {
757 // Shutdown has happened, stop updating JWKS.
758 break;
759 }
760
761 new_jwks = std::make_shared<JWKSSnapshot>();
762 bool is_changed = false;
763 Status status =
764 new_jwks->LoadKeysFromUrl(jwks_uri_, jwks_verify_server_certificate_,
765 current_jwks_checksum_, &is_changed);
766 if (!status.ok()) {
767 LOG(WARNING) << "Failed to update JWKS: " << status.ToString();
768 } else if (is_changed) {
769 SetJWKSSnapshot(new_jwks);
770 if (new_jwks->IsEmpty()) {
771 LOG(WARNING) << "New JWKS snapshot is empty.";
772 }
773 }
774 new_jwks.reset();
775 }
776 // The promise must be set to true.
777 DCHECK(shut_down_promise_.Get());
778}
779
780JWKSSnapshotPtr JWKSMgr::GetJWKSSnapshot() const {
781 std::lock_guard<std::mutex> l(current_jwks_lock_);

Callers

nothing calls this directly

Calls 7

resetMethod · 0.65
WaitForMethod · 0.45
LoadKeysFromUrlMethod · 0.45
okMethod · 0.45
ToStringMethod · 0.45
IsEmptyMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected