Spring Security HTTP Basic Authentication

前端 未结 2 1428
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-03 15:54

I am trying to do a really simple basic authentication with Spring Security. I have configured the namespace properly and there are no Exceptions in the server. In my \"serv

相关标签:
2条回答
  • 2020-12-03 16:19

    Auto-answer

    T_T Two days of hitting my head against the code for this...

    Looks like it is not a problem of the code. I was using Weblogic with it and Weblogic captures the requests with the "authorization" header, so it doesn't get to my authentication-manager. I tried it with glassfish, and it works perfectly.

    Searching for some info, I found an useful entry in the next blog: http://yplakosh.blogspot.com/2009/05/how-to-fix-basic-authentication-issue.html

    Adding the next line in the config.xml from my Weblogic server(<security-configuration> section):

    <enforce-valid-basic-auth-credentials>false</enforce-valid-basic-auth-credentials>

    Weblogic will not catch the basic authentication credentials again, so it will be your authentication-manager who will handle it.

    I hope it can save some time to anyone :-)

    0 讨论(0)
  • 2020-12-03 16:20

    try:

    <http auto-config="true>
       <security:intercept-url method="POST" pattern="/**" access="ROLE_USER" />
       <http-basic />
    </http>
    
    0 讨论(0)
提交回复
热议问题