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:

  1. encrypt token algorithm (which one?) can use decrypt on server side , extract user information
  2. 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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -