I am developing an auth service (NodeJS) that handles authentication and authorization.
I have two endpoints:
/auth-tokenClient apps can fetch auth tokens (JSON web tokens) via POST. The auth service stores each generated JSON web token in its database.
/authorizeOther services within the SOA will verify auth tokens (from Authorization headers) at this endpoint.
Implementation of /authorize
I am not sure about the logic behind the /authorize endpoint.
Method I
- Get auth token from
Authorizationheader - Do a DB lookup of the token and see if it exists and not expired
Method II
- Have a user database within the auth service and store all user info coming to
/auth-tokenendpoint. - If the token has not expired, decode the token.
- Get the user info and do a DB lookup to see if they exist in the user db.
Or some other way. Please let me know.
via ng-hacker-319
No comments:
Post a Comment