Disable Basic Authentication while using Spring Security Java configuration

前端 未结 6 1753
渐次进展
渐次进展 2020-12-01 12:55

I am trying to secure a web application using Spring Security java configuration.

This is how the configuration looks:-



        
6条回答
  •  没有蜡笔的小新
    2020-12-01 13:13

    You can disable the formLogin through the HttpSecurity instance as follow:

    http.authorizeRequests().antMatchers("/public/**").permitAll()
            .antMatchers("/api/**").hasRole("USER")
            .anyRequest().authenticated() 
            .and().formLogin().disable();
    

    This will lead receiving 403 Http error when trying to access any secured resource

提交回复
热议问题