You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Molnar <mo...@mac.com> on 2005/07/11 22:14:12 UTC

Remote Username

I have a quick question and hope that someone can point me in the  
right direction.

Once I have a user do basic authentication into a realm , how can I  
reference the user name and role in the application?

I tried:

String username = req.getRemoteUser();

but all I am getting back is "null".

Thanks,
-Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Remote Username

Posted by Gurumoorthy <g....@btinternet.com>.
are you using only tomcat ?   more details please ... your question does not 
provide an helpful clue ...

Guru
----- Original Message ----- 
From: "Christopher Molnar" <mo...@mac.com>
To: <to...@jakarta.apache.org>
Sent: Monday, July 11, 2005 9:14 PM
Subject: Remote Username


>I have a quick question and hope that someone can point me in the  right 
>direction.
>
> Once I have a user do basic authentication into a realm , how can I 
> reference the user name and role in the application?
>
> I tried:
>
> String username = req.getRemoteUser();
>
> but all I am getting back is "null".
>
> Thanks,
> -Chris
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: Remote Username

Posted by Rob Dickey <ro...@jwisetech.com>.
For username...

java.security.Principal principal =
HttpSession.getRequest().getUserPrincipal();

if( principal!=null ) 
{
	userName = principal.getName();
}

To determine if user is in a specific role...the following call will return
true/false...

HttpSession.getRequest().isUserInRole(rolename);

HTH
Rob
			
-----Original Message-----
From: Christopher Molnar [mailto:molnarc@mac.com] 
Sent: Monday, July 11, 2005 1:14 PM
To: tomcat-user@jakarta.apache.org
Subject: Remote Username

I have a quick question and hope that someone can point me in the  
right direction.

Once I have a user do basic authentication into a realm , how can I  
reference the user name and role in the application?

I tried:

String username = req.getRemoteUser();

but all I am getting back is "null".

Thanks,
-Chris


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org