如何从Java访问Windows凭据? [英] How do I access Windows credentials from Java?

查看:151
本文介绍了如何从Java访问Windows凭据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何(或者我可以?)检索Java中当前登录的Windows用户的缓存凭据?我想在其他一些GSS-API调用中重用这些凭据。具体来说,我正在回答来自IIS的SPNEGO挑战。

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.

谢谢。

推荐答案

假设您使用的是JAVA 5:

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());

这里有一些关于这个主题的信息

这篇关于如何从Java访问Windows凭据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆