File tree Expand file tree Collapse file tree 2 files changed +4
-7
lines changed
Expand file tree Collapse file tree 2 files changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -25,11 +25,8 @@ JWKSType JWKSClient::getJWKS()
2525 auto now = std::chrono::high_resolution_clock::now ();
2626 auto diff = std::chrono::duration<double >(now - last_request_send).count ();
2727
28- if (diff < refresh_timeout)
29- {
30- jwt::jwks <jwt::traits::kazuho_picojson> result (cached_jwks);
31- return result;
32- }
28+ if (diff < refresh_timeout && cached_jwks.has_value ())
29+ return cached_jwks.value ();
3330
3431 Poco::Net::HTTPResponse response;
3532 std::string response_string;
@@ -70,7 +67,7 @@ JWKSType JWKSClient::getJWKS()
7067 }
7168
7269 cached_jwks = std::move (parsed_jwks);
73- return cached_jwks;
70+ return cached_jwks. value () ;
7471}
7572
7673StaticJWKSParams::StaticJWKSParams (const std::string & static_jwks_, const std::string & static_jwks_file_)
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ class JWKSClient : public IJWKSProvider
4343 Poco::URI jwks_uri;
4444
4545 std::shared_mutex mutex;
46- JWKSType cached_jwks;
46+ std::optional< JWKSType> cached_jwks;
4747 std::chrono::time_point<std::chrono::high_resolution_clock> last_request_send;
4848};
4949
You can’t perform that action at this time.
0 commit comments