Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form Based secruity...

 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have implementet formAuthentication. I have basically used LDAP Authentication for this purpose. This seems to work fine. In my loginpage I use j_security:
<form method="POST" action="j_security">
<input type="text" name="j_username" />
<input type="text" name="j_username" />
</form>

Now the autentication part works perfectly fine. But now when I say request.getRemoteUser()... in the j_security servlet, I get null. Is there any thing else, that I need to do... I have been using Tomcat as the web server

thanks in advance
shashank
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you really have two j_username input fields in your form ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getRemoteUser returns null if the user has not been authenticated.
You're probably calling getRemoteUser before the user has actually been authenticated.
 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that was a typing mistake...its j_password.

But the user has successfully been authenticated. I have tried to search for this issue in other forums...No one has answer to this..but couple of people of have the same question...

thanks in advance...

shashank
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which server are you using?
 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat!
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
... version? More information please, for example are you using Apache as a front end?
 
Nikhil Jain
Ranch Hand
Posts: 389
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes I am using Apache...
 
Kartik Lax
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This worked for me, but only if authenticated will it return a value.

request.getUserPrincipal().getName();

-Hellkay
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Shashank Tilwalli:
Now the autentication part works perfectly fine. But now when I say request.getRemoteUser()... in the j_security servlet, I get null. Is there any thing else, that I need to do... I have been using Tomcat as the web server


Um hang on, are you saying you have overridden or replaced the default j_security target?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic