Skip to content

Conversation

@sergiught
Copy link
Contributor

@sergiught sergiught commented Nov 18, 2021

Description

In this PR we ensure that issuer and audience validation happen out of the box.

References

Testing

  • This change adds test coverage for new/changed/fixed functionality

Checklist

  • I have read and agreed to the terms within the Auth0 Code of Conduct.
  • I have read the Auth0 General Contribution Guidelines.
  • I have reviewed my own code beforehand.
  • I have added documentation for new/changed functionality in this PR.
  • All active GitHub checks for tests, formatting, and security are passing.
  • The correct base branch is being used, if not master.

@sergiught sergiught self-assigned this Nov 18, 2021
@sergiught sergiught marked this pull request as ready for review November 18, 2021 14:16
@sergiught sergiught requested a review from a team as a code owner November 18, 2021 14:16
@sergiught sergiught requested a review from a team November 18, 2021 14:21
},
{
name: "it throws an error when it fails to deserialize the claims",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJodHRwczovL2dvLWp3dC1taWRkbGV3YXJlLmV1LmF1dGgwLmNvbS8iLCJzdWIiOiIxMjM0NTY3ODkwIiwiYXVkIjpbImh0dHBzOi8vZ28tand0LW1pZGRsZXdhcmUtYXBpLyJdfQ.vR2K2tZHDrgsEh9zNWcyk4aljtR6gZK0s2anNGlfwz0",
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question, why in this particular case the claims fail to be deserialized, when they seem correct (syntax & expected type)?
The error seems to be related to the signature.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the test name to better reflect why we fail to deserialize the claims.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also changed the signature of the validator.New to not use any jose pkg structs.

return nil, errors.New("keyFunc is required but was nil")
}
if signatureAlgorithm == "" {
return nil, errors.New("signature algorithm is required but was empty")
Copy link
Contributor

Choose a reason for hiding this comment

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

Are these errors tested?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I added them here b7f9883

Copy link
Contributor

@Widcket Widcket left a comment

Choose a reason for hiding this comment

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

Looking good, just have a couple of questions.

@sergiught sergiught force-pushed the patch/SDK-2955-validation branch from 0984691 to b7f9883 Compare November 29, 2021 15:11
@sergiught sergiught requested a review from Widcket November 29, 2021 15:18
Copy link
Contributor

@Widcket Widcket left a comment

Choose a reason for hiding this comment

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

LGTM

@sergiught sergiught merged commit 1ef0531 into master Nov 29, 2021
@sergiught sergiught deleted the patch/SDK-2955-validation branch November 29, 2021 15:26
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.

3 participants