File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Identifying a user Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Identifying a user" Watch "Identifying a user" New topic
Author

Identifying a user

Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Can someone tell me how I identify what user is logged on to windows??
Thanks for any help!
John Dale
Ranch Hand

Joined: Feb 22, 2001
Posts: 399
See System.getProperties(), user.name in particular. Is that what you are after?
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Yes! Thank you very much!!
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
Is there a similar one for the user's password that they are logged on with? I didn't see anything like this in the System API. Also, do you know where I could find some good examples of using the System.getProperties() method? I want to be able to take the user's windows logon and password and pass it to my JDBC connection.
Thanks again!
John Dale
Ranch Hand

Joined: Feb 22, 2001
Posts: 399
I doubt there is a way to get the login password in this manner. That would make for very insecure systems.
Someone in the JDBC forum may have found a way to get a JDBC connection under the current user's ID.
Jennifer Sohl
Ranch Hand

Joined: Feb 28, 2001
Posts: 455
That makes sense. Thanks for your help!
Have a nice day!
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by Jennifer Sohl:
That makes sense. Thanks for your help!
Have a nice day!

You may have to pop up an input message box to ask for their password for authentication to the database. You would probably want to do this anyways to ensure that the user is properly logged on, and that the user is actually the person that is logged on to Windows.
John Dale
Ranch Hand

Joined: Feb 22, 2001
Posts: 399
Typing system passwords into an application seems like a bad security practice. But for all I know, it is necessary.
If you do it, you may want to at least take care to see that it is not left around in memory, files, or in a system dump. You might get some ideas on this from the JavaDoc for javax.swing.JPasswordField and java.net.Authenticator.
Jamie Robertson
Ranch Hand

Joined: Jul 09, 2001
Posts: 1879

Originally posted by John Dale:
Typing system passwords into an application seems like a bad security practice. But for all I know, it is necessary.
If you do it, you may want to at least take care to see that it is not left around in memory, files, or in a system dump. You might get some ideas on this from the JavaDoc for javax.swing.JPasswordField and java.net.Authenticator.

bad wording ( or misleading info ) by me. I did mean to pop up an input field ( JPasswordField ) to input the password info. Thanks for the clarification.
Jamie
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Identifying a user