Detailed explanation of Shiro session expiration time in spring boot actual combat tutorial

preface

As we all know, in spring boot, setting the session expiration time only needs to be in application Add server. In properties session. Timeout configuration is sufficient. When integrating Shiro, it is found that server session. The timeout is set to 7200, but you need to log in again within 2 hours. Later, it is found that Shiro's session has expired, and the expiration time of Shiro's session is not the same as that of server session. The timeout is consistent. At present, it is set by filter.

ShiroSessionFilter

Register filter

Register shirosessionfilter in the class marked with @ configuration annotation.

In this way, when each request is made, if the user has logged in, the Shiro session validity period will be reset to be consistent with the server session.

summary

The above is the whole content of this article. I hope the content of this article has a certain reference value for your study or work. If you have any questions, you can leave a message. Thank you for your support for programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>