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

Support audience option in authenticate request #1004

Merged
merged 9 commits into from
Jun 12, 2023
Merged

Support audience option in authenticate request #1004

merged 9 commits into from
Jun 12, 2023

Conversation

dimkl
Copy link
Contributor

@dimkl dimkl commented Mar 30, 2023

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • gatsby-plugin-clerk
  • build/tooling/chore

Description

  • npm test runs as expected.

  • npm run build runs as expected.

  • manual testing

  • unit tests

Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

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

✅ Great news! Jit hasn't found any security issues in your PR. Good Job! 🏆

@@ -148,31 +152,39 @@ export async function verifyJwt(
}

// Verify audience claim (aud)
if (typeof aud === 'string') {
if (aud !== audience) {
const audiences = audience && Array.isArray(audience) ? audience : [audience];
Copy link
Contributor

Choose a reason for hiding this comment

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

@dimkl we can simplify the checks by wrapping the audience claim (string or string[]) and then do audiences = [audience].flat().filter(aud => !!aud). That way, the following checks will need to assert only on array emptiness.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please review the assertions.test.ts to verify the expected behaviour of our verification audience implementation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@SokratisVidros are we okay with the tests and the expected behaviour? If so, i will proceed with merging this.

@dimkl dimkl force-pushed the issue-978 branch 2 times, most recently from bc0c178 to c72a9f5 Compare April 3, 2023 08:21
@dimkl dimkl force-pushed the issue-978 branch 2 times, most recently from edda3c4 to c4d7ad0 Compare April 7, 2023 12:25
@SokratisVidros
Copy link
Contributor

@dimkl Is this ready for a final review?

@dimkl
Copy link
Contributor Author

dimkl commented Apr 8, 2023

@dimkl Is this ready for a final review?

Yes. A rebase is required before merge but the implementation is finalized.

@dimkl dimkl force-pushed the issue-978 branch 3 times, most recently from b1e0da4 to 2a8b4e9 Compare April 24, 2023 13:16
@dimkl dimkl force-pushed the issue-978 branch 5 times, most recently from 4d6a00d to aa1ab98 Compare May 4, 2023 09:22
@dimkl dimkl force-pushed the issue-978 branch 3 times, most recently from 942c258 to 84f0ea2 Compare May 10, 2023 15:16
@dimkl dimkl force-pushed the issue-978 branch 3 times, most recently from 265d940 to 5042091 Compare May 23, 2023 13:40
@changeset-bot
Copy link

changeset-bot bot commented Jun 12, 2023

🦋 Changeset detected

Latest commit: ce2e061

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@clerk/backend Minor
gatsby-plugin-clerk Patch
@clerk/clerk-sdk-node Patch
@clerk/nextjs Patch
@clerk/remix Patch
@clerk/fastify Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@dimkl dimkl force-pushed the issue-978 branch 2 times, most recently from d71e341 to 6afa5ec Compare June 12, 2023 14:16
@dimkl dimkl merged commit 010484f into main Jun 12, 2023
@dimkl dimkl deleted the issue-978 branch June 12, 2023 14:29
@clerk-cookie clerk-cookie mentioned this pull request Jun 12, 2023
@clerk-cookie
Copy link
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants