Home > Web Front-end > JS Tutorial > body text

JSP Spring implementation method to prevent users from logging in repeatedly

韦小宝
Release: 2018-01-18 09:37:11
Original
1560 people have browsed it

This article mainly introduces JSP JSP related information about Spring’s implementation method to prevent users from logging in repeatedly. Friends who are interested in JSP can refer to this article

JSP Spring’s method of preventing users from logging in repeatedly

Spring security prevents users from logging in repeatedly

How to prevent users from logging in repeatedly using spring security? If the user account is already logged in and then logs in for the second or multiple times, such multiple logins need to be prevented.

1. Configure listener

<listener>
    <listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
Copy after login

in web.

xml 2. In security.xml The configuration in

<session-management>
      <concurrency-control max-sessions="1" error-if-maximum-exceeded="true"/>
</session-management>
Copy after login

max-sessions indicates the maximum number of repeated logins allowed. If error-if-maximum-exceeded is not configured, the second login of the user account will invalidate the first login. If it is configured, the second login will be blocked. Common practice is to prevent a second login.

Related recommendations:

Detailed introduction to jsp page jump

The parameters of the form submitted in jsp are encapsulated into a Method

Declaration and usage instructions of variables and methods in jsp

The above is the detailed content of JSP Spring implementation method to prevent users from logging in repeatedly. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!