Home >Web Front-end >JS Tutorial >JSP Spring implementation method to prevent users from logging in repeatedly

JSP Spring implementation method to prevent users from logging in repeatedly

韦小宝
韦小宝Original
2018-01-18 09:37:111605browse

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>

in web.

xml 2. In security.xml The configuration in

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

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!

Statement:
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