- 
                Notifications
    You must be signed in to change notification settings 
- Fork 432
Return unwrapped keys if able #2812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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
        
          
                test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandlerTests.cs
          
            Show resolved
            Hide resolved
        
      | Should the logic here in JsonWebTokenHandler.DecryptToken be updated as well? | 
| 
 Yeah, good idea. done. | 
        
          
                test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandler.DecryptTokenTests.cs
          
            Show resolved
            Hide resolved
        
      There was a problem hiding this comment.
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.
        
          
                test/Microsoft.IdentityModel.JsonWebTokens.Tests/JsonWebTokenHandler.DecryptTokenTests.cs
              
                Outdated
          
            Show resolved
            Hide resolved
        
      Add test case for no unwrapped keys
| } | ||
|  | ||
| if (unwrappedKeys.Count > 0 && exceptionStrings is null) | ||
| if (unwrappedKeys.Count > 0 || exceptionStrings is null) | 
There was a problem hiding this comment.
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) | 
There was a problem hiding this comment.
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?
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