Add ability to inject extra claims and xsrfToken#248
Add ability to inject extra claims and xsrfToken#248lwcolton wants to merge 6 commits intostormpath:masterfrom HurricaneLabs:add-extra-claims-csrf
Conversation
JWT generation functions were moved into the JWTFactory class. The JWTRequestAuthenticator class was added,and was made the parent class of ApiRequestAuthenticator, OAuthRequestAuthenticator, and OAuthClientCredentialsRequestAuthenticator. These three authenticator classes now allow specifying arbitrary key-value pairs to add in the JWT claims. The also now have support for auto-generating a uuid4 to be used as a CSRF token in the JWT, as described in the "Cookies" section of https://stormpath.com/blog/where-to-store-your-jwts-cookies-vs-html5-web-storage/
|
Codacy is mad because I duplicated code in my test functions. I'm more interested to here what @rdegges or someome from SP thinks of the changes |
|
Thanks for the PR! Going to review this as soon as I have a chance. I've been out on vacation, and am heading to a conference in NYC for a few days. Sorry for the delay :( |
|
Hey @lwcolton, this looks really cool! The refactoring in here is much appreciated. I realize it's taken me way longer than I would have liked to review this, but I wanted to leave some comments.
Other than that, everything looks great. I'm happy to selectively include things from the PR if you want, or you can update it to remove the XSRF stuff yourself and I'll merge directly. Just let me know! If I don't hear back, I'll just go ahead and merge in the bits we'll use (minus the XSRF stuff). Thanks! <3333 |
JWT generation functions were moved into the JWTFactory class.
The JWTRequestAuthenticator class was added,and was made the
parent class of ApiRequestAuthenticator, OAuthRequestAuthenticator,
and OAuthClientCredentialsRequestAuthenticator. These three
authenticator classes now allow specifying arbitrary key-value
pairs to add in the JWT claims. The also now have support for
auto-generating a uuid4 to be used as a CSRF token in the JWT,
as described in the "Cookies" section of
https://stormpath.com/blog/where-to-store-your-jwts-cookies-vs-html5-web-storage/