• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

spring security form based login using database not responding

 
rohan chauhan
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For your users-by-username-query and authorities-by-username-query try


 
Praveen Kondaka
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We are facing similar issue.

Is yours working? Please respond ASAP

Thanks
 
Praveen Kondaka
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For your authoritiesByUsernameQuery you also need username like the following



 
Bhukka Patel
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bhukka Patel wrote:For your authoritiesByUsernameQuery you also need username like the following



 
Praveen Kondaka
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Praveen,

Where is bean:passwordEncoder defined?

Does your database support DECODE function? For purpose of debugging try giving explicit role
 
Praveen Kondaka
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for sharing your config file.

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

Thanks
 
Ngan Le
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Then authentication always fails regardless of whatever login/password I gave, even with the correct login/password.
 
ramzi dridi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


complete example here:
[url=
http://j2eeandroid.blogspot.com/2014/12/spring-security.html]
http://j2eeandroid.blogspot.com/2014/12/spring-security.html[/url]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic