-
Notifications
You must be signed in to change notification settings - Fork 8
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
API: Unify restricted use token generation and validation #70
Comments
Expects tokens payload
|
Created a library to issue and verify the restricted use tokens - https://github.com/citizenos/citizenos-api/blob/master/libs/cosJwt.js |
Idea for TESTING ONLY: sniffer that validates all API links sent in e-mails, checks that they work. |
Live. |
Overview
We issue restricted use JWT tokens for very specific authorization:
...
Problem
The restricted use token format varies quite a bit in the system and creates significant amount of complexity/confusion/overhead in the code-base. It calls for a rewrite so that we can reuse the issuing and validation code.
What token formats are present, where are they issued?
Token usually contains JWT standard parts + Citizen OS extras. The variance is in the Citizen OS extras. For example
path
(string),paths
(Array) where there may or may not bereq.method
prefix.Different path/method format used:here that format is used.
path
- string - Path, NO request method (GET, POST..) limitation. Example:"path": "/api/users/self/topics/:topicId/votes/:voteId/downloads/bdocs/final"
getBdocUrl
- https://github.com/citizenos/citizenos-api/blob/master/routes/api/topic.js#L461getZipURL
- https://github.com/citizenos/citizenos-api/blob/master/routes/api/topic.js#L502_topicUpdate
- https://github.com/citizenos/citizenos-api/blob/master/routes/api/topic.js#L1443paths
- Array - Array of paths with REST methods (GET, POST...). Example:"paths": ["POST_/api/...", "GET_/api/..."]
sendCommentReport
- https://github.com/citizenos/citizenos-api/blob/master/libs/email.js#L570Proposed solution
aud
) to specify the scope of use:aud
(waspath/paths
) - Array - with REST method everywhere. Separated by space instead of "_". For example:"aud": ["GET /api/users/self/topics/:topicId/votes/:voteId/downloads/bdocs/final"]
authTokenRestrictedUse
.The text was updated successfully, but these errors were encountered: