Skip to content

How to use this plugin with alternative authentication at the same time? #222

Answered by ch4mpy
ea-ncu asked this question in Q&A
Discussion options

You must be logged in to vote

As this would be done without spring-addons: define a security filter-chain bean for each of these other security mechanisms.

Use an @Order of at maximum LOWEST_PRECEDENCE + 2 (spring-addons resource server filter chain is ordered with LOWEST_PRECEDENCE and client's one with LOWEST_PRECEDENCE + 1.

Do not forget the securityMatcher in your own filter-chain(s) or you'll hide spring-addons ones.

@Configuration
public class SecurityConfig {

    @Bean
    @Order(Ordered.HIGHEST_PRECEDENCE)
    SecurityFilterChain basicAuthFilterChain(HttpSecurity http) throws Exception {
        // process only requests with HTTP Basic Authorization
        http.securityMatcher((HttpServletRequest request) ->…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ch4mpy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants