web application: how to get the currently logged in user?

  • Follow


Hi,

i want to get the username of the currently logged in user (system login on
a windows domain) with a jsp or a servlet.
Can anybody help me?

thanks...

-- 
bye Stephan...


0
Reply Stephan 11/19/2003 9:59:09 AM

Stephan:

This'll do it for you:
String userSystemName = System.getProperty("user.name");

0
Reply Dave 11/19/2003 1:48:11 PM


Dave Vick wrote:
> Stephan:
> 
> This'll do it for you:
> String userSystemName = System.getProperty("user.name");
> 

Did you test this?
I wonder to know how a software which executes on a server can get the 
currently logged in user on a remote client machine using this command.

For me, using a jsp or a servlet or a servlet, it is not directly 
possible to get the currently logged in user as the jsp or servlet is 
invoked through HTTP which is anonymous.

Maybe did I missing the real intent of the initial question

Fr�d�ric

0
Reply windows 11/19/2003 4:11:22 PM

Gedin Fr�d�ric wrote:
> Dave Vick wrote:
> 
>> Stephan:
>>
>> This'll do it for you:
>> String userSystemName = System.getProperty("user.name");
>>
> 
> Did you test this?
> I wonder to know how a software which executes on a server can get the 
> currently logged in user on a remote client machine using this command.
> 
> For me, using a jsp or a servlet or a servlet, it is not directly 
> possible to get the currently logged in user as the jsp or servlet is 
> invoked through HTTP which is anonymous.
> 
> Maybe did I missing the real intent of the initial question

   Yes. The OP did not specify whether he wanted the user currently 
logged in on the client or the user currently logged in on the server.

--Mike Amling

0
Reply Michael 11/19/2003 5:38:25 PM

Michael Amling wrote:
> Gedin Fr�d�ric wrote:
> 
>> Dave Vick wrote:
>>
>>> Stephan:
>>>
>>> This'll do it for you:
>>> String userSystemName = System.getProperty("user.name");
>>>
>>
>> Did you test this?
>> I wonder to know how a software which executes on a server can get the 
>> currently logged in user on a remote client machine using this command.
>>
>> For me, using a jsp or a servlet or a servlet, it is not directly 
>> possible to get the currently logged in user as the jsp or servlet is 
>> invoked through HTTP which is anonymous.
>>
>> Maybe did I missing the real intent of the initial question
> 
> 
>   Yes. The OP did not specify whether he wanted the user currently 
> logged in on the client or the user currently logged in on the server.
> 
> --Mike Amling
> 
Yes but he mentionned using JSP or servlets

Fr�d�ric

0
Reply windows 11/19/2003 6:09:12 PM

Have a look at http://jcifs.samba.org/src/docs/ntlmhttpauth.html.
Only works with MS Internet Explorer.

Patrick

Dave Vick wrote:
> Stephan:
> 
> This'll do it for you:
> String userSystemName = System.getProperty("user.name");
> 

0
Reply Patrick 11/19/2003 8:29:51 PM

Patrick Carl wrote:
> Have a look at http://jcifs.samba.org/src/docs/ntlmhttpauth.html.
> Only works with MS Internet Explorer.
> 
> Patrick
> 
> Dave Vick wrote:
> 
>> Stephan:
>>
>> This'll do it for you:
>> String userSystemName = System.getProperty("user.name");
>>
> 

A more general solution could consist in implementing a filter in the 
application server which will invoke a SSO.  It is more complicated but 
it works everywhere with a better security.

A good example is documented here 
http://www-106.ibm.com/developerworks/web/library/wa-singlesign/

Fr�d�ric

0
Reply windows 11/19/2003 9:20:07 PM

"Gedin Fr�d�ric" <frederic.gedin@free.fr> schrieb im Newsbeitrag
news:3fbb954d$0$2806$626a54ce@news.free.fr...
> Dave Vick wrote:
> > Stephan:
> >
> > This'll do it for you:
> > String userSystemName = System.getProperty("user.name");
> >
>
> Did you test this?
> I wonder to know how a software which executes on a server can get the
> currently logged in user on a remote client machine using this command.
>
> For me, using a jsp or a servlet or a servlet, it is not directly
> possible to get the currently logged in user as the jsp or servlet is
> invoked through HTTP which is anonymous.
>
> Maybe did I missing the real intent of the initial question

No, that is exactly what I meant. I know that this is possible in
combination with the IIS. That works afaik with the so called NTLM
'protocol'. Where the Browser sends the login information with a request.
I wonder if there is a servlet or anything like that, that emulates the
behavior of the IIS.

-- 
bye Stephan...


0
Reply Stephan 11/20/2003 7:54:16 AM

"Michael Amling" <nospam@nospam.com> schrieb im Newsbeitrag
news:lUNub.679$aw2.571517@newssrv26.news.prodigy.com...
> Gedin Fr�d�ric wrote:
> > Dave Vick wrote:
> >
> >> Stephan:
> >>
> >> This'll do it for you:
> >> String userSystemName = System.getProperty("user.name");
> >>
> >
> > Did you test this?
> > I wonder to know how a software which executes on a server can get the
> > currently logged in user on a remote client machine using this command.
> >
> > For me, using a jsp or a servlet or a servlet, it is not directly
> > possible to get the currently logged in user as the jsp or servlet is
> > invoked through HTTP which is anonymous.
> >
> > Maybe did I missing the real intent of the initial question
>
>    Yes. The OP did not specify whether he wanted the user currently
> logged in on the client or the user currently logged in on the server.

Sorry - my mistake: I meant the currently logged in user on the client side.

-- 
bye Stephan...


0
Reply Stephan 11/20/2003 7:55:17 AM

"Patrick Carl" <carl.patrick@nefkom.net> schrieb im Newsbeitrag
news:bpgjrv$et8$1@news1.nefonline.de...
> Have a look at http://jcifs.samba.org/src/docs/ntlmhttpauth.html.
> Only works with MS Internet Explorer.

Ok, i read this. But as I understand this is used to authorize the access to
any file sharing. How is it then possible to get the username of the user?
Can I then use the getRemoteUser() method?
I need the username for a LDAP (ADS) Lookup for the groups the user belongs
to.

--
bye Stephan...


0
Reply Stephan 11/20/2003 8:12:52 AM

Stephan Koser wrote:

> No, that is exactly what I meant. I know that this is possible in
> combination with the IIS. That works afaik with the so called NTLM
> 'protocol'. Where the Browser sends the login information with a request.
> I wonder if there is a servlet or anything like that, that emulates the
> behavior of the IIS.

Wedgetail claims to do that: http://www.wedgetail.com/jcsi/sso/

You didn't say you want it for free, did you ?

Matthias
-- 
Matthias Ernst
CoreMedia - Smart Content Technology

"Overall, JAXP is much like the rest of Java: a partial description
intended to assist developers in using a single implementation"
0
Reply Matthias 11/20/2003 11:18:03 AM

Stephan Koser wrote:
> "Patrick Carl" <carl.patrick@nefkom.net> schrieb im Newsbeitrag
> news:bpgjrv$et8$1@news1.nefonline.de...
> 
>>Have a look at http://jcifs.samba.org/src/docs/ntlmhttpauth.html.
>>Only works with MS Internet Explorer.
> 
> 
> Ok, i read this. But as I understand this is used to authorize the access to
> any file sharing. How is it then possible to get the username of the user?
> Can I then use the getRemoteUser() method?
> I need the username for a LDAP (ADS) Lookup for the groups the user belongs
> to.
> 
> --
> bye Stephan...
> 
> 

Once the filter has got the authorisation, it can add the user id in the 
  HTTP query before returning to the actual serlet invocation.  Just 
read the use of the servlet filters.  I do not have a good pointer here 
but google should do it for you!

Fr�d�ric

0
Reply windows 11/20/2003 11:03:30 PM

11 Replies
629 Views

(page loaded in 0.106 seconds)

Similiar Articles:


















7/21/2012 4:55:12 AM


Reply: