The requirement is that ,I need windows userName and password as a application login userName and password. So, any please tell me how to retrieve windows userName and password and how to use it in intranet application login userName and password.
Asked
Active
Viewed 7,979 times
0
-
2If this were feasible, it would be a *huge* security problem. – Jon Skeet May 12 '16 at 09:39
-
In a windows domain environment to authenticate a logged on user with a web server on the same domain hosting an intranet site you would use *Integrated Windows Authentication* (ntlm/kerberos) – Alex K. May 12 '16 at 09:42
-
@JonSkeet I think that he is more interested in authenticating a user using his Windows credentials than getting the user's password in plain text. – Lefteris008 May 12 '16 at 09:45
-
@Lefteris008: Well, it depends on what the "intranet application login" requires... if that hasn't been integrated into Windows authentication, it could be tricky... – Jon Skeet May 12 '16 at 09:47
-
@JonSkeet You are right, I assumed that the application employed the Windows Authentication System (Credential Manager etc.). – Lefteris008 May 12 '16 at 09:49
-
@Lefteris008: I just need to validate the the application login with those credentials not password in Plain text.Is there any way to do this?? – sajju May 12 '16 at 13:29
-
@sajju As JonSkeet suggested, if this was possible for **every** application, then no password should be safe. You have to integrate your app using the Windows Authentication (ntlm/kerberos). Look at the duplicated question above and search for the Integrated Windows Authentication Framework. – Lefteris008 May 12 '16 at 13:33
-
@sajju _Clarifaction:_ if there was a simple API or library that would allow someone to send an encrypted password and then inform him that this password was *valid*, even though the system wouldn't return that password, someone may "sit in the middle" and store it at the time the user enters it in **plain text** and ensure that this is correct when the library sends the *OK* flag. In other words, the lib must be contained in a larger framework that would take care even for the password input. *That* is the Windows Authentication I mentioned earlier. – Lefteris008 May 12 '16 at 13:39
2 Answers
1
You can access the system info using the System.getProperties() function like below.
Properties p = System.getProperties();
p.list(System.out);
If you want a particular property like username, then you could do it like the following:
System.out.println(System.getProperty("user.name"));
But as far as I'm aware, the system password is not available as a system property as it will be a massive security hole.
DhiwaTdG
- 748
- 1
- 10
- 26
0
No you can not read password.
you will get current user by System.getProperty("user.name");
Gan
- 624
- 1
- 10
- 31