How to prevent multiple logins using the same username and password in Spring security

2.7k Views Asked by At

I have implemented spring security with a restful API using spring boot and everything work perfectly. I wan't to prevent multiple login with the same username and password from the same client. how can I do that ?

1

There are 1 best solutions below

4
manu On

The only approach that I can think of is to identify the clients by their IP and then only allow one login per client. Here‘s a tutorial on how to block accounts after several login failed attempts from the same IP / client.

http://www.baeldung.com/spring-security-block-brute-force-authentication-attempts

Maybe it could give you an idea on how to solve your problem.

Please be aware that there are some problems coming with this, like dynamic IP addresses (the user gets a new IP address after disconnecting) and if more than one user uses the same proxy and therefore all of them have the same IP address.