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

LA 194 refreshing oauth credentials #5569

Merged
merged 8 commits into from
Dec 9, 2024

Conversation

Vagoasdf
Copy link
Contributor

@Vagoasdf Vagoasdf commented Dec 6, 2024

Closes LA#194

Description Of Changes

We were seeing trouble with OAuth Client Credentials strategies, as the token is not being refreshed properly, as the base class was expecting a refresh request to exist. For that, we are adding an override function on the Client Credentials strategy that can properly refresh the token

Code Changes

Adding a override function on OAuth2ClientCredentialsAuthenticationStrategy for refreshing the access token, using the base token request instead of the refresh request, since the Client Credentials OAuth connection does not uses a separate refresh request call.

Steps to Confirm

  1. Set up a local OAuth2 Credentials integration. Currently PowerReviews is our only working Oauth2 Integration
  2. Execute an erasure request to confirm a working integration
  3. Wait for the Expiration of the access_token request. PowerReviews by defaults sets their expires_in at 3600 seconds
  4. After the time has passed, execute another erasure request. Previously, this would've return a 401 expired token request. Now it should refresh the token properly

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
  • Followup issues:
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Copy link

vercel bot commented Dec 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
fides-plus-nightly ⬜️ Ignored (Inspect) Visit Preview Dec 9, 2024 7:02pm

Copy link

cypress bot commented Dec 6, 2024

fides    Run #11362

Run Properties:  status check passed Passed #11362  •  git commit 8ceb3a5ee8 ℹ️: Merge 92c4f87cb9c10c96fd729fda3283e60bb9301509 into d848f4b63fe6199f7d95a24c71f4...
Project fides
Branch Review refs/pull/5569/merge
Run status status check passed Passed #11362
Run duration 00m 48s
Commit git commit 8ceb3a5ee8 ℹ️: Merge 92c4f87cb9c10c96fd729fda3283e60bb9301509 into d848f4b63fe6199f7d95a24c71f4...
Committer Bruno Gutierrez Rios
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

@Vagoasdf Vagoasdf force-pushed the LA-194-Refreshing-Oauth-credentials branch from 5c2550f to e2b1791 Compare December 9, 2024 15:31
@Vagoasdf Vagoasdf marked this pull request as ready for review December 9, 2024 15:31
The test that we care most about is test_oauth2_authentication_successful_refresh, since it test a proper refresh. Its working correctly

Also removed some logging that carried over our research
Carry over from previous issue regarding client_credentials wich was patched last friday Dec 6
@Vagoasdf Vagoasdf force-pushed the LA-194-Refreshing-Oauth-credentials branch from e97ad47 to 9bd6c24 Compare December 9, 2024 15:57
@galvana galvana self-requested a review December 9, 2024 17:39
Copy link
Contributor

@galvana galvana left a comment

Choose a reason for hiding this comment

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

Nice approach! I just made a small update to one of the doc strings but this looks good to me

…auth2_client_credentials.py

Co-authored-by: Adrian Galvan <adrian@ethyca.com>
@Vagoasdf Vagoasdf merged commit 5600b5e into main Dec 9, 2024
35 of 37 checks passed
@Vagoasdf Vagoasdf deleted the LA-194-Refreshing-Oauth-credentials branch December 9, 2024 20:23
Copy link

cypress bot commented Dec 9, 2024

fides    Run #11366

Run Properties:  status check passed Passed #11366  •  git commit 5600b5e65f: LA 194 refreshing oauth credentials (#5569)
Project fides
Branch Review main
Run status status check passed Passed #11366
Run duration 00m 55s
Commit git commit 5600b5e65f: LA 194 refreshing oauth credentials (#5569)
Committer Bruno Gutierrez Rios
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 4
⚠️ You've recorded test results over your free plan limit.
Upgrade your plan to view test results.
View all changes introduced in this branch ↗︎

eastandwestwind pushed a commit that referenced this pull request Dec 10, 2024
Co-authored-by: Adrian Galvan <adrian@ethyca.com>
andres-torres-marroquin pushed a commit that referenced this pull request Dec 11, 2024
Co-authored-by: Adrian Galvan <adrian@ethyca.com>
eastandwestwind pushed a commit that referenced this pull request Dec 11, 2024
Co-authored-by: Adrian Galvan <adrian@ethyca.com>
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