Stage 5 3. Micro Services [online] _day17 studies Zuul_09- front-end user authentication to display the current user - needs analysis

Successful landing should you want to display user information



cookie only keep the user's identity token. Information does not contain the user's


holding short token request to the authentication service acquisition jwt. Then stored sessionStorage

1, user authentication service request, the login is successful.
2, the user login is successful, the authentication service writes to the cookie identity token, write user_token (identity tokens and authorization jwt authorization token) to Redis
3, the client carries a cookie identity token authentication service request token acquiring jwt .
4, client parses jwt token and user information stored in the sessionStorage resolved.
jwt token includes the basic information of the user, the client can obtain the token parsing jwt user information.
5, the client user information is read from sessionStorage and displayed in the header.
sessionStorage:
sessionStorage is a session storage object H5, the data stored in SessionStorage only valid in the same window or in the same tab,
will delete the data SessionStorage after closing the window.
seesionStorage using the storage key / value way, data can be stored about 5M (will be different in different browsers)

End



 

Guess you like

Origin www.cnblogs.com/wangjunwei/p/11641037.html