@@ -21,7 +21,8 @@ jwt::jwks<jwt::traits::kazuho_picojson> JWKSClient::getJWKS()
2121 auto now = std::chrono::high_resolution_clock::now ();
2222 auto diff = std::chrono::duration<double >(now - last_request_send).count ();
2323
24- if (diff < refresh_timeout) {
24+ if (diff < refresh_timeout)
25+ {
2526 jwt::jwks <jwt::traits::kazuho_picojson> result (cached_jwks);
2627 return result;
2728 }
@@ -31,14 +32,18 @@ jwt::jwks<jwt::traits::kazuho_picojson> JWKSClient::getJWKS()
3132
3233 Poco::Net::HTTPRequest request{Poco::Net::HTTPRequest::HTTP_GET, jwks_uri.getPathAndQuery ()};
3334
34- if (jwks_uri.getScheme () == " https" ) {
35+ if (jwks_uri.getScheme () == " https" )
36+ {
3537 Poco::Net::HTTPSClientSession session = Poco::Net::HTTPSClientSession (jwks_uri.getHost (), jwks_uri.getPort ());
3638 session.sendRequest (request);
3739 std::istream & responseStream = session.receiveResponse (response);
3840 if (response.getStatus () != Poco::Net::HTTPResponse::HTTP_OK || !responseStream)
39- throw Exception (ErrorCodes::AUTHENTICATION_FAILED, " Failed to get user info by access token, code: {}, reason: {}" , response.getStatus (), response.getReason ());
41+ throw Exception (ErrorCodes::AUTHENTICATION_FAILED, " Failed to get user info by access token, code: {}, reason: {}" ,
42+ response.getStatus (), response.getReason ());
4043 Poco::StreamCopier::copyStream (responseStream, responseString);
41- } else {
44+ }
45+ else
46+ {
4247 Poco::Net::HTTPClientSession session = Poco::Net::HTTPClientSession (jwks_uri.getHost (), jwks_uri.getPort ());
4348 session.sendRequest (request);
4449 std::istream & responseStream = session.receiveResponse (response);
@@ -51,10 +56,12 @@ jwt::jwks<jwt::traits::kazuho_picojson> JWKSClient::getJWKS()
5156
5257 jwt::jwks<jwt::traits::kazuho_picojson> parsed_jwks;
5358
54- try {
59+ try
60+ {
5561 parsed_jwks = jwt::parse_jwks (responseString.str ());
5662 }
57- catch (const Exception & e) {
63+ catch (const Exception & e)
64+ {
5865 throw Exception (ErrorCodes::AUTHENTICATION_FAILED, " Failed to parse JWKS: {}" , e.what ());
5966 }
6067
@@ -78,7 +85,8 @@ StaticJWKSParams::StaticJWKSParams(const std::string &static_jwks_, const std::s
7885StaticJWKS::StaticJWKS (const StaticJWKSParams ¶ms)
7986{
8087 String content = String (params.static_jwks );
81- if (!params.static_jwks_file .empty ()) {
88+ if (!params.static_jwks_file .empty ())
89+ {
8290 std::ifstream ifs (params.static_jwks_file );
8391 content = String ((std::istreambuf_iterator<char >(ifs)), (std::istreambuf_iterator<char >()));
8492 }
0 commit comments