开发者

configuring spring security for HTTP POST method

开发者 https://www.devze.com 2023-02-11 06:47 出处:网络
I am using spring security 3.0. I want to disable authentication for a url that handles POST method.This doesnt seem to work -

I am using spring security 3.0.

I want to disable authentication for a url that handles POST method. This doesnt seem to work -

<http  use-expressions="true" auto-config="true">

    <intercept-url pattern="/index.html" access="permitAll()"/>
    <intercept-url method="POST" pattern="/api/feedback/**" access="IS_AUTHENTICATED_ANONYMOUSLY" />

    <anonymous/>
</http>

method="POST" doesnt seem to be working and I get an authorization error POSTi开发者_StackOverflow社区ng to that url.

What should I do?


Considereing the permitAll is working, I can tell that you're using expressions, so you must change IS_AUTHENTICATED_ANONYMOUSLY to isAnonymous() or permitAll

edit: other way, should be to change to hasRole('ROLE_ANONYMOUS')

your shot ;)

0

精彩评论

暂无评论...
验证码 换一张
取 消