Conversation
…he tool Co-authored-by: djw8605 <79268+djw8605@users.noreply.github.com>
…lity Co-authored-by: djw8605 <79268+djw8605@users.noreply.github.com>
|
@copilot Modify the scitokens-keycache file to have different options.
|
…cation) Co-authored-by: djw8605 <79268+djw8605@users.noreply.github.com>
I've successfully modified the scitokens-keycache tool to support the requested subcommands:
All commands work with both explicit Commit: 8bdaa4a Warning Firewall rules blocked me from connecting to one or more addressesI tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
lint
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 217 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 221 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 230 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 234 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 238 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 242 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 244 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 246 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 250 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 253 to 258 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 260 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 266 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 270 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 273 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 279 to 283 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 286 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 288 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 292 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 294 to 295 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 297 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 300 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 302 to 303 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 305 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 308 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 311 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 314 to 317 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 319 to 324 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 328 to 329 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 331 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 335 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 337 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 340 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 342 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 345 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 349 to 352 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 354 to 360 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 365 to 370 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 374 to 378 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 381 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 385 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 388 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 393 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 399 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 409 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 411 to 412 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 415 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 418 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 421 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 428 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 430 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 444 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 447 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 452 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 456 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 465 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 467 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens.cpp
Line 992 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens.cpp
Line 1007 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens.cpp
Line 1148 in 6639c01
[lint] reported by reviewdog 🐶
Line 7 in 6639c01
[lint] reported by reviewdog 🐶
Line 9 in 6639c01
[lint] reported by reviewdog 🐶
Line 298 in 6639c01
[lint] reported by reviewdog 🐶
Line 300 in 6639c01
[lint] reported by reviewdog 🐶
Line 345 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_cache.cpp
Line 99 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_cache.cpp
Line 109 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_internal.h
Line 119 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_internal.h
Line 129 in 6639c01
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_internal.h
Line 767 in 6639c01
[lint] reported by reviewdog 🐶
Line 846 in 6639c01
[lint] reported by reviewdog 🐶
Line 853 in 6639c01
[lint] reported by reviewdog 🐶
Line 856 in 6639c01
[lint] reported by reviewdog 🐶
Lines 860 to 863 in 6639c01
[lint] reported by reviewdog 🐶
Line 865 in 6639c01
[lint] reported by reviewdog 🐶
Line 873 in 6639c01
[lint] reported by reviewdog 🐶
Line 875 in 6639c01
[lint] reported by reviewdog 🐶
Line 883 in 6639c01
[lint] reported by reviewdog 🐶
Line 890 in 6639c01
[lint] reported by reviewdog 🐶
Line 893 in 6639c01
[lint] reported by reviewdog 🐶
Lines 897 to 900 in 6639c01
[lint] reported by reviewdog 🐶
Line 902 in 6639c01
[lint] reported by reviewdog 🐶
Line 910 in 6639c01
[lint] reported by reviewdog 🐶
Line 912 in 6639c01
| #include <cstdlib> | ||
| #include <cstring> | ||
| #include <ctime> | ||
| #include <iostream> |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <iostream> |
| #include <string> | ||
| #include <unistd.h> |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <string> | |
| #include <unistd.h> |
| #include <string> | ||
| #include <unistd.h> | ||
| #include <iomanip> | ||
| #include <sqlite3.h> |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <sqlite3.h> | |
| #include <iostream> | |
| #include <sqlite3.h> |
| #include <unistd.h> | ||
| #include <iomanip> | ||
| #include <sqlite3.h> | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <string> | |
| #include <unistd.h> | |
| std::cout << "Commands:\n"; | ||
| std::cout << " add Add JWKS to a keycache file\n"; | ||
| std::cout << " print Print table of all public keys stored in cache\n"; | ||
| std::cout << " location Print location of scitokens keycache and access status\n"; |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::cout << " location Print location of scitokens keycache and access status\n"; | |
| std::cout << " location Print location of scitokens keycache and access " | |
| "status\n"; |
| std::cout << "Expires at: " << ctime(&now) << " + " << valid_for << " seconds\n"; | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::cout << "Expires at: " << ctime(&now) << " + " << valid_for << " seconds\n"; | |
| std::cout << "Expires at: " << ctime(&now) << " + " << valid_for | |
| << " seconds\n"; | |
| if (err_msg) { | ||
| free(err_msg); | ||
| } | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::cerr << "Error: " << e.what() << "\n"; | ||
| return 1; | ||
| } | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
|
|
||
| int print_command(int argc, char *argv[]) { | ||
| std::string cache_file; | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::string cache_file; | ||
|
|
||
| // Parse command line arguments for print command | ||
| for (int i = 2; i < argc; i++) { // Start from 2 since argv[1] is "print" |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| for (int i = 2; i < argc; i++) { // Start from 2 since argv[1] is "print" | |
| for (int i = 2; i < argc; i++) { // Start from 2 since argv[1] is "print" |
There was a problem hiding this comment.
Remaining comments which cannot be posted as a review comment to avoid GitHub Rate Limit
lint
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 217 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 221 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 230 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 234 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 238 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 242 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 244 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 246 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 250 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 253 to 258 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 260 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 266 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 270 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 273 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 279 to 283 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 286 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 288 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 292 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 294 to 295 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 297 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 300 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 302 to 303 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 305 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 308 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 311 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 314 to 317 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 319 to 324 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 328 to 329 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 331 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 335 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 337 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 340 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 342 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 345 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 349 to 352 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 354 to 360 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 365 to 370 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 374 to 378 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 381 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 385 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 388 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 393 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 399 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 409 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Lines 411 to 412 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 415 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 418 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 421 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 428 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 430 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 444 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 447 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 452 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 456 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 465 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens-keycache.cpp
Line 467 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens.cpp
Line 992 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens.cpp
Line 1007 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens.cpp
Line 1148 in d9f2c49
[lint] reported by reviewdog 🐶
Line 7 in d9f2c49
[lint] reported by reviewdog 🐶
Line 9 in d9f2c49
[lint] reported by reviewdog 🐶
Line 298 in d9f2c49
[lint] reported by reviewdog 🐶
Line 300 in d9f2c49
[lint] reported by reviewdog 🐶
Line 345 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_cache.cpp
Line 99 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_cache.cpp
Line 109 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_internal.h
Line 119 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_internal.h
Line 129 in d9f2c49
[lint] reported by reviewdog 🐶
scitokens-cpp/src/scitokens_internal.h
Line 767 in d9f2c49
[lint] reported by reviewdog 🐶
Line 846 in d9f2c49
[lint] reported by reviewdog 🐶
Line 853 in d9f2c49
[lint] reported by reviewdog 🐶
Line 856 in d9f2c49
[lint] reported by reviewdog 🐶
Lines 860 to 863 in d9f2c49
[lint] reported by reviewdog 🐶
Line 865 in d9f2c49
[lint] reported by reviewdog 🐶
Line 873 in d9f2c49
[lint] reported by reviewdog 🐶
Line 875 in d9f2c49
[lint] reported by reviewdog 🐶
Line 883 in d9f2c49
[lint] reported by reviewdog 🐶
Line 890 in d9f2c49
[lint] reported by reviewdog 🐶
Line 893 in d9f2c49
[lint] reported by reviewdog 🐶
Lines 897 to 900 in d9f2c49
[lint] reported by reviewdog 🐶
Line 902 in d9f2c49
[lint] reported by reviewdog 🐶
Line 910 in d9f2c49
[lint] reported by reviewdog 🐶
Line 912 in d9f2c49
| #include <cstdlib> | ||
| #include <cstring> | ||
| #include <ctime> | ||
| #include <iostream> |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <iostream> |
| #include <string> | ||
| #include <unistd.h> |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <string> | |
| #include <unistd.h> |
| #include <string> | ||
| #include <unistd.h> | ||
| #include <iomanip> | ||
| #include <sqlite3.h> |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <sqlite3.h> | |
| #include <iostream> | |
| #include <sqlite3.h> |
| #include <unistd.h> | ||
| #include <iomanip> | ||
| #include <sqlite3.h> | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| #include <string> | |
| #include <unistd.h> | |
| std::cout << "Commands:\n"; | ||
| std::cout << " add Add JWKS to a keycache file\n"; | ||
| std::cout << " print Print table of all public keys stored in cache\n"; | ||
| std::cout << " location Print location of scitokens keycache and access status\n"; |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::cout << " location Print location of scitokens keycache and access status\n"; | |
| std::cout << " location Print location of scitokens keycache and access " | |
| "status\n"; |
| std::cout << "Expires at: " << ctime(&now) << " + " << valid_for << " seconds\n"; | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::cout << "Expires at: " << ctime(&now) << " + " << valid_for << " seconds\n"; | |
| std::cout << "Expires at: " << ctime(&now) << " + " << valid_for | |
| << " seconds\n"; | |
| if (err_msg) { | ||
| free(err_msg); | ||
| } | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::cerr << "Error: " << e.what() << "\n"; | ||
| return 1; | ||
| } | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
|
|
||
| int print_command(int argc, char *argv[]) { | ||
| std::string cache_file; | ||
|
|
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| std::string cache_file; | ||
|
|
||
| // Parse command line arguments for print command | ||
| for (int i = 2; i < argc; i++) { // Start from 2 since argv[1] is "print" |
There was a problem hiding this comment.
[lint] reported by reviewdog 🐶
| for (int i = 2; i < argc; i++) { // Start from 2 since argv[1] is "print" | |
| for (int i = 2; i < argc; i++) { // Start from 2 since argv[1] is "print" |
This PR implements offline support for the scitokens library, enabling environments where external network access to fetch public keys is not available or desired.
Key Features Added
1. SCITOKENS_KEYCACHE_FILE Environment Variable
Added support for a new environment variable that points directly to a SQLite database file for the key cache, bypassing the normal cache location resolution:
export SCITOKENS_KEYCACHE_FILE=/path/to/offline.dbThe cache location priority is now:
SCITOKENS_KEYCACHE_FILE(highest priority - for offline use)XDG_CACHE_HOMEenvironment variable~/.cachedirectory (lowest priority)2. Enhanced scitokens-keycache Command Line Tool
Completely redesigned the command-line utility with subcommands for comprehensive cache management:
scitokens-keycache addCreates and populates offline cache files with JWKS data:
scitokens-keycache add --cache-file /opt/tokens/cache.db \ --jwks issuer_keys.json \ --issuer https://tokens.example.com \ --valid-for 86400scitokens-keycache printDisplays a formatted table of all cached public keys with truncated values for terminal readability:
scitokens-keycache print [--cache-file /path/to/cache.db] # Output shows: Issuer | Key ID | Key Type | Expires | Next Update | Public Key (truncated)scitokens-keycache locationShows the active cache file location and accessibility status:
3. Enhanced API
Added a new C API function for programmatic storage of JWKS with explicit expiration times:
Implementation Details
get_cache_file()inscitokens_cache.cppto check for the environment variable firstValidatorclass withstore_jwks_with_expiry()methodscitokens-keycache.cppwith subcommand architectureint64_ttype compatibilityBackward Compatibility
All existing functionality remains unchanged. The new features are additive:
scitokens-keycacheusage patterns still work via theaddsubcommandTesting
Use Cases
This enables fully offline scitokens operation and enhanced cache management for:
The enhanced tool provides administrators with comprehensive visibility into cached keys and simplified workflows for offline deployments.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.