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

Adds JwtFlow to support JWT authentication #2

Merged
merged 5 commits into from
Apr 16, 2024
Merged

Conversation

brberry
Copy link
Contributor

@brberry brberry commented Apr 6, 2024

This adds a new authentication type, JwtFlow. I did not create tests for this because I don't really know how give the infrastructure requirements. Also, I thought the check for sandbox might be better added to the Client, but I but it on the new class instead because I think that should be your design decision.

Copy link
Owner

@georgebv georgebv left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution!

I'm not very familiar with jwt flow in SF - does it support token refreshes?

Also, you don't have to change anything but I'm going to move the dependency to optional later before release - I don't want to require every user to depend on pyjwt as it causes trouble in some cloud environments.

self._expiration_time: float | None = None

async def _acquire_new_access_token(self, client: "Salesforce") -> str:
expiration = int(time.time()) + 300
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't this use the timeout attribute you set earlier?

@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 26.08696% with 34 lines in your changes are missing coverage. Please review.

Project coverage is 88.54%. Comparing base (cb5cdb3) to head (989dd03).

Files Patch % Lines
src/aiosalesforce/auth/jwt_flow.py 24.44% 34 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main       #2      +/-   ##
==========================================
- Coverage   92.13%   88.54%   -3.59%     
==========================================
  Files          20       21       +1     
  Lines         801      847      +46     
==========================================
+ Hits          738      750      +12     
- Misses         63       97      +34     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@georgebv
Copy link
Owner

I recommend running pre-commit to avoid lint errors

@georgebv
Copy link
Owner

To move things forward, are you OK with merging it as is and me taking it over the finish line? I would like to experiment with it myself a bit before committing to a specific interface. You will still be getting credit for contribution.

If yes, please revert changes to pyproject.toml (this will be optional dependency).

@brberry
Copy link
Contributor Author

brberry commented Apr 16, 2024

Sure, I've checked in a version that undoes the change. If that's not what's needed, then I'm not sure how to pull out just that change from the original PR

@georgebv georgebv merged commit e2d5651 into georgebv:main Apr 16, 2024
0 of 5 checks passed
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