简体   繁体   English

Jinterop模仿

[英]Jinterop impersonation

I use the Jinterop library for an access to remote WMI. 我使用Jinterop库访问远程WMI。

JISystem.setAutoRegisteration(true);
JISession session = JISession.createSession(System.getenv("USERDOMAIN"), login, password);
session.useSessionSecurity(true);
final JIComServer server = new JIComServer(JIProgId.valueOf(WBEM_PROGID), HOST, session);

I want to use impersonation for accessing with current user and password to remote machine. 我想使用模拟功能以当前用户名和密码访问远程计算机。 But when I use empty login and password, I always get exception 但是当我使用空的登录名和密码时,总是会出现异常

jcifs.smb.SmbAuthException: Logon failure: unknown user name or bad password.
    at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:546)

Is this possible to use impersonation in Jinterop? 在Jinterop中可以使用模拟吗?

I am not 100% sure, but I have worked with j-interop for some time and I have never seen or read about this feature, so I don't think that this is possible. 我不确定100%,但是我在j-interop上工作了一段时间,但从未见过或阅读过此功能,所以我认为这是不可能的。 In my opinion you always have to specify the credentials. 我认为您始终必须指定凭据。

Further, I am curious if this is really working for you?: 此外,我很好奇这是否真的对您有用?:

JISystem.setAutoRegisteration(true);

This means that j-interop will automatically try to modify values/keys in the registry as needed. 这意味着j-interop将根据需要自动尝试修改注册表中的值/键。 In my experience, in case you want to access the WbemScripting.SWbemLocator class, due to tighter security constraints (the necessary keys are owned by the 'TrustedInstaller' user) this automatic modification is not possible any more starting from Windows Vista and above. 以我的经验,如果您希望访问WbemScripting.SWbemLocator类,则由于更严格的安全限制(必需的密钥由“ TrustedInstaller”用户拥有),从Windows Vista及更高版本开始将无法再进行此自动修改。 I always had to set this to false and modify the values/keys manually in the registry. 我总是必须将此设置为false并在注册表中手动修改值/键。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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