Problem/Motivation
Every user should be able to have one or more RSA keys. By using RSA we can allow the user to generate the key locally and save the public key in Drupal or allow Drupal to generate and present the private key for download and save only the public key in the database. This alleviates the need for secure storage of symmetric secrets.
see
https://github.com/gabesullice/jwt/issues/27
Proposed resolution
Add a sub-module that supports creating and storing one or more RSA keys per user.
Remaining tasks
Make it so the auth steps checks the key ID and user id - the JWT code makes this a little tricky.
User interface changes
Possibly add one or more tabs by the user profile
Comments
Comment #2
pwolanin commentedJust dumping in here what I had started on - not sure how much is working.
Comment #3
pwolanin commentedThis could also be a separate project, but not sure which makes more sense?
Comment #4
pwolanin commenteded25519 is an emerging elliptic curve standard that could be a good choice to support, though it's not in the standard.
However, only the NIST curves are supported in the official JWT standard:
https://tools.ietf.org/html/rfc7518#section-3
Comment #5
pwolanin commentedThis other JWT library supports it, but let's try just RSA for now and possibly make a PR on the firebase library to add support.
https://github.com/web-token/jwt-signature-algorithm-eddsa
Comment #6
pwolanin commentedHere's some more progress, switch to trying to use the user data service for storing keys.
Comment #7
pwolanin commentedMore progress. Starting on Kernel test.
Comment #8
pwolanin commentedusing new fallback header name per #3032702: Fallback header for use when basic authorization header is also sent
Comment #9
pwolanin commentedWith more added test cases in Kernel test
Comment #10
pwolanin commentedWIP for building forms
Comment #11
pwolanin commentedbetter forms
Comment #12
pwolanin commentedAdd form to generate RSA key
Comment #13
pwolanin commentedready for initial review.
Comment #15
pwolanin commentedoops, needed to use the full URL becuase testbot is in a subdirectory. Also added more test assertions.
Comment #16
pwolanin commentedComment #18
pwolanin commentedAnnoying, passes locally. try without a check for redirect.
Comment #19
pwolanin commentedOk, IDK why the testbot doesn't redirect, but it's not that important.
Comment #21
dandrews commentedCode from patch 19 reviewed. Everything was well written, great documentation, and lots of tests. CI is passing.
Tested on Drupal 8.8.6, worked great.
Item noted for future improvement: Configurable expiration time for JWT. Related issue JWT Make expiration time configurable
Comment #22
dandrews commentedComment #23
pwolanin commentedComment #24
pwolanin commented