Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I access Windows credentials from Java?

How do I (or can I?) retrieve the cached credentials for the currently logged-in Windows user in Java? I want to reuse these credentials in some other GSS-API calls. Specifically, I'm answering an SPNEGO challenge from IIS.

Thanks.

like image 201
findango Avatar asked Jul 14 '09 16:07

findango


People also ask

Is there a way to view password stored in Windows credentials?

If you need to see the list of your credentials, you may go to Control Panel > User Accounts > Credential Manager. You may click the dropdown arrow then click Show on Password field. Please note that it will ask you to re-enter the password to verify your identity.


1 Answers

assuming you are using JAVA 5:

com.sun.security.auth.module.NTSystem NTSystem = new com.sun.security.auth.module.NTSystem();
System.out.println(NTSystem.getName());

here is some info on the subject

like image 144
northpole Avatar answered Oct 03 '22 12:10

northpole