Spring security with multiple login pages

前端 未结 4 2416
暖寄归人
暖寄归人 2021-02-04 08:59

I am using Spring security to secure login to the application admin section with a username and password. But now my client need to have another login screen for the application

4条回答
  •  既然无缘
    2021-02-04 09:34

    According to the Spring Security docs:

    From Spring Security 3.1 it is now possible to use multiple http elements to define separate security filter chain configurations for different request patterns. If the pattern attribute is omitted from an http element, it matches all requests.

    Each element creates a filter chain within the internal FilterChainProxy and the URL pattern that should be mapped to it. The elements will be added in the order they are declared, so the most specific patterns must again be declared first.

    So, essentially you need two elements each with a different pattern attribute.

    There's a detailed tutorial here: https://blog.codecentric.de/en/2012/07/spring-security-two-security-realms-in-one-application/

提交回复
热议问题