简体   繁体   中英

Spring security doesn't work on Glassfish v3

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 "The 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

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 .

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 technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM