This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java in General and the fly likes system properties Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "system properties" Watch "system properties" New topic

system properties

vivek sivakumar
Ranch Hand

Joined: Aug 09, 2001
Posts: 187
hi tell me how to proceed !!
i have a java application (nothing but a collection of jsp pages) where i authenticate the contents of the jsp page by a user name password , what i need is that this username and password should be taken directly from the windows system!! to be more clear the user if authorised to enter into the windows system then he should be also auhorised to use my application.
is there any class in java to do this or can anyone givea smaple code.

SCJP, SCWD <br />A farmer learns more from a bad harvest than a good one.
Mo Ibrahim

Joined: Jul 10, 2001
Posts: 28
Getting the user name is easy. You can get the logged-in user name by executing "cmd echo %username%" in a process and read the stream using an InputBufferStreamReader.
But, you will not be able to get the password from windows because of encoding. I heard someone say that you can set a registry key and get the password out. I do not know how. I am also looking for a way to figure out a solution to this problem. If you find out, please post it.
Peter Kristensson
Ranch Hand

Joined: Jul 02, 2001
Posts: 118
I find it hard to believe that the username is stored in plain text anywhere on your windows system. If this was the case, someone would probably have found out by now, and used this information with malicous intent.
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
I believe that it is possible with JAAS (PAM framework)
There is a native module nt.dll for Windows NT.

Pierre-Fran´┐Żois Lemosquet

Joined: Sep 07, 2001
Posts: 25
Yikes, this is a bit tough. Remind me why we can't just use .htaccess?
I agree. Here's the link:
subject: system properties
It's not a secret anymore!