File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Identifying a user

 
Jennifer Sohl
Ranch Hand
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can someone tell me how I identify what user is logged on to windows??
Thanks for any help!
 
John Dale
Ranch Hand
Posts: 399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See System.getProperties(), user.name in particular. Is that what you are after?
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes! Thank you very much!!
 
Jennifer Sohl
Ranch Hand
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 455
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That makes sense. Thanks for your help!
Have a nice day!
 
Jamie Robertson
Ranch Hand
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1879
MySQL Database Suse
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic