Skip to content

Return unwrapped keys if able#2812

Merged
keegan-caruso merged 3 commits into
devfrom
kecaruso/fix-keywrap-error
Sep 9, 2024
Merged

Return unwrapped keys if able#2812
keegan-caruso merged 3 commits into
devfrom
kecaruso/fix-keywrap-error

Conversation

@keegan-caruso

Copy link
Copy Markdown
Contributor

Description

JsonWebTokenHandler would only return unwrapped keys if there was no errors. This change is to align with the behavior in JwtSecurityTokenHandler, that is it returns the keys that were able to be unwrapped, and only throw if no keys were able to be unwrapped.

Relates to #2695

JsonWebTokenHandler would only return unwrapped keys if there was no errors.
This change is to align with the behavior in JwtSecurityTokenHandler, that is
it returns the keys that were able to be unwrapped, and only throw if no keys
were able to be unwrapped.

Relates to #2695
@keegan-caruso
keegan-caruso requested a review from a team as a code owner September 5, 2024 20:54
@sruke

sruke commented Sep 5, 2024

Copy link
Copy Markdown
Contributor

Should the logic here in JsonWebTokenHandler.DecryptToken be updated as well?

@keegan-caruso

Copy link
Copy Markdown
Contributor Author

Should the logic here in JsonWebTokenHandler.DecryptToken be updated as well?

Yeah, good idea. done.

@iNinja iNinja left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comment, otherwise looks good.

@keegan-caruso
keegan-caruso merged commit ad4ec65 into dev Sep 9, 2024
@keegan-caruso
keegan-caruso deleted the kecaruso/fix-keywrap-error branch September 9, 2024 18:07
}

if (unwrappedKeys.Count > 0 && exceptionStrings is null)
if (unwrappedKeys.Count > 0 || exceptionStrings is null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we care about exceptionStrings if we have found any possible keys?

}

if (unwrappedKeys.Count > 0 && exceptionStrings is null)
if (unwrappedKeys.Count > 0 || exceptionStrings is null)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we care about exceptionStrings if we have some keys?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants