Spring Boot限制用户名的并发会话

问题描述

我想限制一个用户名的多个同时登录。即每个用户名一个登录/会话。

如果用户尝试使用已经登录用户名登录,则会显示错误

这是我的SecurityConfiguration

protected void configure(HttpSecurity http) throws Exception
    {
        http.cors().and().csrf().disable().
                 authorizeRequests()
                .antMatchers("/app/login").permitAll()
                .antMatchers("/application/**").authenticated()
                .and()
                .exceptionHandling().authenticationEntryPoint(unauthorizedHandler).and()
                .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS);

       ............................
    }

我也尝试过 Disable multiple logins for same user in spring security + spring boot 但对我没用

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)