Java REST service using authentication token

前端 未结 3 1877
春和景丽
春和景丽 2021-02-05 11:57

On my web app using Java EE 6. I want to expose some of my functionality as a Json Rest Service. I want to use authentication tokens for login, User will send their username, pa

3条回答
  •  隐瞒了意图╮
    2021-02-05 12:26

    Heres my input:

    • I would save the token in DB, in case you need to restart the server you don't want to lose all your user's tokens. You could potentially save it in memory as well to speed up requests and only look it up in DB if it is not found in memory.

    • I would accept the token in the header. I would put the rest service on HTTPS so the request is encrypted and then you don't need to worry about encrypting the token manually in the request

    • I would probably look at JAX-RS and see what features it offers

提交回复
热议问题