java - Token based authentication for REST service: where to store generated token on server-side? -
i'm trying implement token authentication rest service based on spring mvc.
i'm followiong answer: https://stackoverflow.com/a/10864088/1061499 guideline, need understand server-side detail.
when user authenticated (first time via username + password) return token stores information. when same user sent token in request header, need identify associated user , define if "session" still alive.
so way two:
- encrypt token algorithm (which one?) can use decrypt on server side , extract user information
- store token-user association info in application db storing session info.
most suggest first solution, without storing info authentication in db, solution seems me less secure.
any suggestion?
Comments
Post a Comment