Spring Security permitAll() not allowing anonymous access

前端 未结 4 1949
无人共我
无人共我 2020-12-08 02:04

I have a single method that I want to allow both anonymous and authenticated access to.

I am using Spring Security 3.2.4 with java based configuration.

The o

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-08 02:36

    The permission order is important, it works when I configure it like this:

    .authorizeRequests()
            .antMatchers("/ping**")
            .permitAll()
            .and()
    .authorizeRequests()
            .anyRequest()
            .authenticated()
            .and()
    

提交回复
热议问题