How does Java use token for authentication?

< H1 > main requirements < / H1 > < H2 > Front end: < / H2 >
  1. token can be obtained through username / password
  2. with token in headers, you can access the restricted API
< H2 > backend: < / H2 >
  1. you can create a token with expiration time
  2. you can verify whether token is valid or expired
  3. can invalidate the specified token

read Jwt , but it seems that you can"t take the initiative to invalidate token .

Apr.11,2021

redis or put a table in the database, store the mapping of token and uid .

active invalidation means directly emptying the uid corresponding token .

each time, check whether uid has a corresponding token , and check it as you wish. Refresh is to generate a new token overlay.

Menu