简体   繁体   中英

reliable and platform-independent way of getting logged-in user in java

We need a java application to run on both solaris and windows machines and they are kerberized . We use JGSS to get the Princiapl corresponding to the logged-in user in Solaris , by specifying the loction of credential cache that is stored in KRB5CCNAME . Since windows doesn't store the details in a file like solaris does, and since we don't want to use NTSystem to get the logged-in user's name , is there a generic way to get these details from a java program ? I see a lot of references mentioning about JSSE and SSPI to get these details.

Could someone please help?

There is a function which returns informations similar to what you have asked. And for logged in user name, it is used as

String username = System.getProperty("user.name");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM