Spring Security exclude url patterns in security annotation configurartion

后端 未结 4 1847
迷失自我
迷失自我 2020-11-29 01:23

I have spring web application with Spring security configured using java config approach. I want to exclude some URL patterns from authentication(eg: static resources etc..)

4条回答
  •  [愿得一人]
    2020-11-29 02:04

    specifying the "antMatcher" before "authorizeRequests()" like below will restrict the authenticaiton to only those URLs specified in "antMatcher"

    http.csrf().disable() .antMatcher("/apiurlneedsauth/**").authorizeRequests().

提交回复
热议问题