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

Validate client ID in DID Token. #87

Merged
merged 3 commits into from
Jul 10, 2023
Merged

Conversation

magic-ravi
Copy link
Contributor

@magic-ravi magic-ravi commented Jun 29, 2023

📦 Pull Request

[Provide a general summary of the pull request here.]

Validate aud field in DID Token by comparing it to client ID. Pull Client ID from Magic servers if not present.

🗜 Versioning

(Check one!)

  • Patch: Bug Fix?
  • Minor: New Feature?
  • Major: Breaking Change?

✅ Fixed Issues

  • [List any fixed issues here like: Fixes #XXXX]

🚨 Test instructions

[Describe any additional context required to test the PR/feature/bug fix.]
Tested:

  1. Magic Auth DID token generated and successfully validated.
  2. Generated a DID token under a different api key -> successfully rejected.

⚠️ Update CHANGELOG.md

  • I have updated the Upcoming Changes section of CHANGELOG.md with context related to this Pull Request.

@magic-ravi magic-ravi self-assigned this Jun 29, 2023
Copy link
Contributor

@justinnout justinnout left a comment

Choose a reason for hiding this comment

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

looks good just one comment

Comment on lines +40 to +42
init_requests_client = RequestsClient(retries, timeout, backoff_factor)
magic_admin.client_id = client_id or \
init_requests_client.request('get', self.v1_client_info).data['client_id']
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the client already set up

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's scoped to the specific Resources :( I ran into issues trying to get it to work with the existing client so I ended up initializing my own.

@magic-ravi
Copy link
Contributor Author

Still need to test this thoroughly (build the library, install it, try making the calls)

justinnout
justinnout previously approved these changes Jun 29, 2023
@magic-ravi magic-ravi marked this pull request as ready for review July 5, 2023 21:11
@magic-ravi magic-ravi merged commit 44907fa into master Jul 10, 2023
1 of 2 checks passed
@magic-ravi magic-ravi deleted the ravi-sc80094-ValidateAud branch July 10, 2023 17:12
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.

2 participants