1. Decentralized JWT Token
- decentralized, easy for distributed systems to use Basic information can be placed directly in the token. Username, NICKNAME, ROLE function permission information can be placed directly in the token. Use a bit to represent the user’s functional authority.
Disadvantages: The server cannot actively invalidate the token
2. Centralized Redis Token/Memory Session, etc
Advantages: The server can actively invalidate the token
Cons: Redis queries need to be done every time. Occupying Redis storage space.
Here Redis stores a whitelist of tokens. Other information about the user is also stored in Redis. It takes up a lot of Redis space and queries.
3. Optimization scheme:
- Jwt Token> add TokenId Storing the TokenID field in Redis so that the server can actively control token invalidation sacrifices the decentralized nature of JWT. Use asymmetric encryption. The authentication server that issued the token stores the private key: the private key generates the signature. Other business systems store public keys: The public key verifies the signature.
Here, Redis only stores the blacklist of TokenID, and Redis can also be distributed with separate reads and writes. Token authenticates the server to operate on Redis’ master, and other Redis synchronize the master’s data
https://www.zhihu.com/question/274566992
Read More:
- [Solved] Error in registering Eureka for spring cloud micro service: classnotfoundexception: org.apache.http.conn.scheme.schemeregistry
- Unable to read Scheme Document ‘ http://www.springframework.org/schema/beans/spring-beans-4.1.xsd ‘ [How to Fix]
- Spring security failed to log in, error: there is no passwordencoder mapped for the ID “null”
- egg.js The frame post request reported an error of invalid CSRF token security verification, which has been solved
- Unable to read scheme document‘ http://www.springframework.org/schema/spring-context.xsd The solution to the problem
- spring security There was an unexpected error (type=Forbidden, status=403).
- Realization of springboot authorization verification technology based on JWT
- (20200916 Solved)Docker||redis-cli Could not connect to Redis at 127.0.0.1:6379: Connection refused
- Error connecting to redis on localhost:6379 (Redis::TimeoutError)
- Centos7 offline installation of redis and PHP extension redis
- About writing [if] and [else] statements in JSP, Syntax error on token “else”, delete this token
- Token bucket implementation with adaptive token generation rate
- Redis: How to Configurate Redis.conf File
- [Solved] Redis Error: org.springframework.data.redis.RedisConnectionFailureExceptionjava.net.SocketTimeoutException
- The spring boot set appears in the stand-alone version of redis Servlet.service () for servlet [dispatcherServlet] in context with path [] thr
- Syntax error on token “eat”, identifier expected after this token
- Syntax error on token “}“, delete this token
- Off line data storage and upload scheme
- Non real time fast synchronization scheme for mobile devices