Skip to content

Commit

Permalink
scitokens_internal: refactor case for "kid" not present
Browse files Browse the repository at this point in the history
The vendored jwt-cpp version offers a convenience function
to check whether the header claim is present, use that instead of
accessing it and catching the exception.
  • Loading branch information
olifre committed Jun 5, 2023
1 parent c4c8140 commit 66f8d67
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/scitokens_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -497,10 +497,8 @@ class Validator {
std::string algorithm;
// Key id is optional in the RFC, set to blank if it doesn't exist
std::string key_id;
try {
if (jwt.has_key_id()) {
key_id = jwt.get_key_id();
} catch (const jwt::error::claim_not_present_exception &) {
// Don't do anything, key_id is empty, as it should be.
}
auto status =
get_public_key_pem(jwt.get_issuer(), key_id, public_pem, algorithm);
Expand Down

0 comments on commit 66f8d67

Please sign in to comment.