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

Method UpdateJWKSThread

be/src/util/jwt-util.cc:803–827  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

801}
802
803void JWKSMgr::UpdateJWKSThread() {
804 std::shared_ptr<JWKSSnapshot> new_jwks;
805 int64_t timeout_millis = FLAGS_jwks_update_frequency_s * 1000;
806 while (true) {
807 // This Get() will time out until shutdown, when the promise is set.
808 bool timed_out;
809 shut_down_promise_.Get(timeout_millis, &timed_out);
810 if (!timed_out) break;
811
812 new_jwks = std::make_shared<JWKSSnapshot>();
813 bool is_changed = false;
814 Status status =
815 new_jwks->LoadKeysFromUrl(jwks_uri_, jwks_verify_server_certificate_,
816 jwks_ca_certificate_, current_jwks_checksum_, &is_changed);
817 if (!status.ok()) {
818 LOG(WARNING) << "Failed to update JWKS: " << status;
819 } else if (is_changed) {
820 SetJWKSSnapshot(new_jwks);
821 }
822 new_jwks.reset();
823 }
824 // The promise must be set to true.
825 DCHECK(shut_down_promise_.IsSet());
826 DCHECK(shut_down_promise_.Get());
827}
828
829JWKSSnapshotPtr JWKSMgr::GetJWKSSnapshot() const {
830 std::lock_guard<std::mutex> l(current_jwks_lock_);

Callers

nothing calls this directly

Calls 5

resetMethod · 0.65
GetMethod · 0.45
LoadKeysFromUrlMethod · 0.45
okMethod · 0.45
IsSetMethod · 0.45

Tested by

no test coverage detected