How do I access Windows credentials from Java?

20,894

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

Share:
20,894
findango
Author by

findango

Updated on July 21, 2020

Comments

  • findango
    findango almost 4 years

    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.