Skip to content
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

MEDIUM FIX: Avoid Innermost Exception Validation #62

Open
ElbekDeveloper opened this issue Aug 7, 2024 · 1 comment
Open

MEDIUM FIX: Avoid Innermost Exception Validation #62

ElbekDeveloper opened this issue Aug 7, 2024 · 1 comment

Comments

@ElbekDeveloper
Copy link

The Problem

We are testing against SecurityTokenMalformedException coming from Microsoft.IdentityModel.Tokens namespace. The inner exception of it is throwing the following error while test is running:

Expected inner exception (level 2) message to be "Value does not fall within the expected range.", but found "IDX12709: CanReadToken() returned false. JWT is not well formed.
The token needs to be in JWS or JWE Compact Serialization Format. (JWS): 'EncodedHeader.EncodedPayload.EncodedSignature'. (JWE): 'EncodedProtectedHeader.EncodedEncryptedKey.EncodedInitializationVector.EncodedCiphertext.EncodedAuthenticationTag'."

The Ask

I don't want the library to go as deep. How can I ignore the validation after 1 level starting from system exception

@cjdutoit
Copy link
Collaborator

cjdutoit commented Aug 7, 2024

@ElbekDeveloper, this is expected behaviour. Is this for a unit test? You should be able to setup your expected exception to be thrown by the unit test and then verify that the actual exception match the expected exception.

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

No branches or pull requests

2 participants