开发者

Spring security doesn't work on Glassfish v3

开发者 https://www.devze.com 2023-04-07 23:26 出处:网络
I have a java web application that use spring security for log in users, restriction access etc. , and it is working without problems on Glassfish 2.1, Tomcat, jetty, but on glassfish v3doesn\'t work,

I have a java web application that use spring security for log in users, restriction access etc. , and it is working without problems on Glassfish 2.1, Tomcat, jetty, but on glassfish v3 doesn't work, when I try to login, and press button login, I'm getting login box from glassfish server(the box "T开发者_运维百科he server xxxx requires user name and password").

Has somebody got such issue? Please let me know how I can solve this.

Thanks, Iurie


I don't know what is causing this (and potentially it could be one of a number of things), but I suggest that you turn the logging level up to the max and see if that gives you some clues as to what is going on. (When the logging level is DEBUG or higher, SpringSecurity generates lots of logging.)


... the request is not sent to spring security, the glassfish stopped it with his basic authentication, the question is why.

I don't know what the cause of this is, but it sounds like some aspect of Glassfish authentication / authorization needs to be turned off if you want to use SpringSecurity. (Maybe you did this in your Glassfish 2.1 installation ...)

The way that SpringSecurity works, you will definitely see logging messages if a request goes to a servlet that has the SS filter chain in place. It is possible that there is a SS misconfiguration that means that you've not got the SS filter chain in place, but I suspect that the real problem is that Glassfish is doing its bit before the requests get sent to the filter chain.


Try to comment the following fragment:

<login-config>
  <auth-method>BASIC</auth-method>
</login-config>

in ".../glassfish/domains/domain1/config/default-web.xml" file


Did you create a JDBC Connection pool and Resource in Glassfish server?

For ex:

User: root     
Password: java     
databaseName: theDatabase     
serverName: localhost     
portNumber: 3306    
driverClass: com.mysql.jdbc.Driver   
URL: jdbc:mysql://localhost:3306/dbname  


The issue seems to be confusion over the /j_spring_security_check url, if you change it everything works again.

<security:form-login login-processing-url="/whatever_security_check" />

See this.

0

精彩评论

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