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

Add support of target_user_id claim + tests #56

Merged
merged 2 commits into from
Aug 17, 2021
Merged

Conversation

pjanik
Copy link
Member

@pjanik pjanik commented Aug 13, 2021

[#179181398]

If the user has target_user_id claim, he would be able to download AWS credentials.
I'm not specifying any new rule access rule type. It's based on the owner rule. If it adds some value, we could actually disable or enable target_user_id access in resource settings. But not sure if it's worth it unless we want to explicitly disable it somewhere.

Some other changes:

  • I've removed isOwnerOrMember helper and related tests. It felt overloaded at this point. canCreateKeys use other methods directly. Tests assertions have been redistributed to correct places (they were in fact replicating other tests, as it was OR join of few methods), so no tests have been lost I hope.
  • index.tests.ts has a new JWT claim - jwtTokenWithTargetUserId. It's a different pattern than most of the old tests used. They seemed to simulate access using rules. This time I've tried to use a different JWT, as it didn't feel right to include target_user_id to the default jwtToken used by most of the tests. And setup would be more confusing. In fact, we could actually refactor most of the tets to use different JWTs (like jwtTokenContextMember, jwtTokenMember, etc.). I think it's pretty symmetric, but probably easier to type JWT name in a new test rather than copy and modify the array of access rules.

@pjanik pjanik requested a review from scytacki August 13, 2021 13:52
Copy link
Member

@scytacki scytacki 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 to me

Base automatically changed from 179181363-context-access-rule to master August 17, 2021 08:08
@pjanik pjanik merged commit dfa0caa into master Aug 17, 2021
@pjanik pjanik deleted the 179181398-target-user-id branch August 17, 2021 08:08
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