我正在尝试实现华夫饼示例代码,但是发现该示例尝试执行不带参数的WindowsSecurityContextImpl.Initialize。这会导致语法错误。
这是我的代码:
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException, SQLException {
try {
String securityPackage = "Negotiate";
IWindowsCredentialsHandle clientCredentials = WindowsCredentialsHandleImpl.getCurrent(securityPackage);
clientCredentials.initialize();
WindowsSecurityContextImpl clientContext = new WindowsSecurityContextImpl();
clientContext.setPrincipalName(Advapi32Util.getUserName());
clientContext.setCredentialsHandle((IWindowsCredentialsHandle)clientCredentials.getHandle());
clientContext.setSecurityPackage(securityPackage);
clientContext.initialize();
Netbeans抱怨初始化需要3个参数:
clientContext.initialize(CtxHandle continueCtx,SecBufDesc continueToken, String targetName)
我不知道如何填充这些参数。