aspose file tools*
The moose likes Spring and the fly likes spring security form based login using database not responding Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "spring security form based login using database not responding" Watch "spring security form based login using database not responding" New topic
Author

spring security form based login using database not responding

rohan chauhan
Greenhorn

Joined: May 08, 2009
Posts: 1
hi all,
I'm doing spring-security form based validation using database. Its all working if i use Inmemory user n pwd.


if i use last commented code then its work well. but when i use query then nothing happens. only 2 lines shown at jboss console but stil login page remains there. and not allows to me to go my actual page after right unm n pwd. and not even display below code for next any successful/wrong login entry.



again if i write wrong querey intensely then also no sql error shown. Whats wrong here.

Bhukka Patel
Greenhorn

Joined: Jun 03, 2009
Posts: 5
For your users-by-username-query and authorities-by-username-query try


Praveen Kondaka
Greenhorn

Joined: May 05, 2004
Posts: 7
We are facing similar issue.

Is yours working? Please respond ASAP

Thanks


SCJP, SCEA
Praveen Kondaka
Greenhorn

Joined: May 05, 2004
Posts: 7
My applicationConext-security.xml looks like this.




I am getting following displayed in console. It is not showing any error or stackTrace. I am not sure what i am missing.




My Login.jsp looks like this.



I really apprecieate for quick response.

Thanks Folks
Bhukka Patel
Greenhorn

Joined: Jun 03, 2009
Posts: 5
For your authoritiesByUsernameQuery you also need username like the following



Bhukka Patel
Greenhorn

Joined: Jun 03, 2009
Posts: 5
Bhukka Patel wrote:For your authoritiesByUsernameQuery you also need username like the following



Praveen Kondaka
Greenhorn

Joined: May 05, 2004
Posts: 7
Thanks Bhukka Patel. I apprecieate your help.

Actually it was there. since i was playing with different options, i pasted wrong one.




Anyway, i tried with above configuration. still it is not working. same message in my app server console.



Besides applicationConext-security.xml do i need any other configuration? Am i missing anything?

Your help is greatly apprecieated.

Cheers!!

Bhukka Patel
Greenhorn

Joined: Jun 03, 2009
Posts: 5
Hi Praveen,

Where is bean:passwordEncoder defined?

Does your database support DECODE function? For purpose of debugging try giving explicit role
Praveen Kondaka
Greenhorn

Joined: May 05, 2004
Posts: 7
For now i am not using any passwordEncoder. my password is plain password in database and i am using same password in in my form field.

About your other suggestion, I removed DECODE and tried
Bhukka Patel
Greenhorn

Joined: Jun 03, 2009
Posts: 5
Here is security config file that I use. My filters are auto configured as my security requriements are simple at this point.

Praveen Kondaka
Greenhorn

Joined: May 05, 2004
Posts: 7
Thanks for sharing your config file.

How is your login.jsp/login.htm looks like. where do you submit?

Thanks
Ngan Le
Greenhorn

Joined: Mar 04, 2010
Posts: 2
It seems Spring Security doesn't check or do anything within the authorities-by-username-query of my security context.xml file. Do I need to explicitly tell it to check? When I intentionally give an invalid table within the users-by-username-query, I do get back errors indicating bad sql but not for the authorities-by-username-query. Did i miss anything? Thanks.

Here is the snippet code in my security context.xml:
Ngan Le
Greenhorn

Joined: Mar 04, 2010
Posts: 2
Then authentication always fails regardless of whatever login/password I gave, even with the correct login/password.
ramzi dridi
Greenhorn

Joined: Dec 14, 2014
Posts: 5


complete example here:
[url=
http://j2eeandroid.blogspot.com/2014/12/spring-security.html]
http://j2eeandroid.blogspot.com/2014/12/spring-security.html[/url]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: spring security form based login using database not responding