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

JWT tokens inside Cookies #27

Merged
merged 24 commits into from Jul 2, 2020
Merged

Conversation

phrfpeixoto
Copy link
Contributor

These changes adds support for using JWT token on HttpOnly cookies.

Key benefits are:

  • Cookies are usually dealt with automatically by browsers.
  • Allow sliding sessions
  • Still stateless: does not use server-side sessions

src/pyramid_jwt/__init__.py Outdated Show resolved Hide resolved
src/pyramid_jwt/policy.py Outdated Show resolved Hide resolved
src/pyramid_jwt/policy.py Show resolved Hide resolved
src/pyramid_jwt/policy.py Outdated Show resolved Hide resolved
@phrfpeixoto
Copy link
Contributor Author

Thanks for the comments. I'll assess this again as soon as I can find some time.

@phrfpeixoto
Copy link
Contributor Author

@wichert I found some time to dedicate to this, but it seems your current master branch is failing tests.

@phrfpeixoto
Copy link
Contributor Author

phrfpeixoto commented May 6, 2020

@wichert I have rebased this branch to the current master and augmented tests. Coverage looks good to me at this time. Please review my last comments and let me know if you need any changes.

Please note that there's always the option that we bake the whole cookie support within the original JWTAuthenticationPolicy class instead of coding a new policy like I did. Let me know if you find that a better solution.

@wichert
Copy link
Owner

wichert commented May 9, 2020

This looks very good! Can you please also add an example to the README?

@dragonnn
Copy link

dragonnn commented Jun 26, 2020

Hi, what is the progress? I am starting with a new site using pyramid and would love to use tokens inside Cookies.

@phrfpeixoto
Copy link
Contributor Author

Hi!
I'm sorry I haven't found the time to push the code. It's ready and just needs a bit of cleanup.
I'll do it this weekend.

@dragonnn
Copy link

Great! Pleas provide also some examples, I installed it manually and now trying to figure out how it is working.

@phrfpeixoto
Copy link
Contributor Author

@wichert @dragonnn Updated the PR with some fixes and documentation. Could you please review it again?

Again: Please note that there's always the option that we bake the whole cookie support within the original JWTAuthenticationPolicy class instead of coding a new policy as I've done. Let me know if you find that a better solution.

@phrfpeixoto phrfpeixoto requested a review from wichert July 1, 2020 13:39
@wichert wichert merged commit aec3ddb into wichert:master Jul 2, 2020
@wichert
Copy link
Owner

wichert commented Jul 2, 2020

@phrfpeixoto This looks great! I’ve merged the pull request and will look at making a release soon.

@phrfpeixoto
Copy link
Contributor Author

Nice!

@phrfpeixoto phrfpeixoto deleted the jwt_in_cookie branch July 2, 2020 15:15
@dragonnn
Copy link

dragonnn commented Jul 6, 2020

I can confirm it works fine :), can you bump the version/create a release so pip catches it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants