Micro Spring cloud security services combat -5-8 achieve SSO (session valid authentication server) based on the session

The authentication server session expiration date.


That is, the authentication server session on the validity of

the next generation environment, the authentication server must be a cluster. Clusters. Then the session must be shared among all the servers. The easiest way is to use Spring Session to achieve.

sharing session

Plus a dependency in pom.xml authentication server.

Jdbc can also be used with a session can be. Here is a selection of jdbc

use jdbc then need to build some tables. Construction of the table statement here and there. While the corresponding MySql made some changes.

After the completion of the implementation will be more than two tables, so that our session will be saved to the database. Session can be shared among multiple authentication service

annotate within the configuration file

test

The next Oauth2 authentication server restarts

admin services are restarted, so that both sides of the session and then emptied the operation access will trigger landing.




More than a database record.

This time the authentication server and admin services are closed.

Restart admin

restart the authentication server

though my application server restart, but my session are saved to the database. Refresh the page or directly enter the home.

You can see the authentication server to access

back to the admin application and log

timeout session of. Or the like arranged in the configuration. 2592000 configuration here is one month.

 

End





 

Guess you like

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