在 Java Web 应用程序中获取 Windows 登录详细信息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4628561/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Get Windows Login details in Java Web Application
提问by SPD
What is the procedure to get Windows Login Details in java? Ours is a web application, need to get Windows login username. any thoughts folks
在java中获取Windows登录详细信息的过程是什么?我们的是一个网络应用程序,需要获取 Windows 登录用户名。大家有什么想法
-PD
-PD
回答by Ratna Dinakar
In Javascript
在 JavaScript 中
var userName='';
var userDomain='';
var wshshell=new ActiveXObject("wscript.network");
//write to some (hidden) form field
with (document.formname) {
userName=wshshell.username;
userDomain=wshshell.userdomain;
}
wshshell=null;
you can pass the variables to hidden parameters and submit them along with form or pass them using ajax. !
您可以将变量传递给隐藏参数并将它们与表单一起提交或使用 ajax 传递它们。!
回答by Romain Hippeau
This is about as good as you are going to get. It requires the user be using IE.
http://www.rgagnon.com/javadetails/java-0441.html
这与您将获得的一样好。它要求用户使用 IE。
http://www.rgagnon.com/javadetails/java-0441.html
回答by diagonalbatman
Can you use
你能用吗
System.getProperty("user.name");
From a web app?
从网络应用程序?