java 域伺服器 驗證 到與伺服器端用域使用者進行身份驗證:
阿新 • • 發佈:2019-01-28
try {
UniAddress dc = UniAddress.getByName("192.168.10.229");
jcifs.smb.NtlmPasswordAuthentication auth =new jcifs.smb.NtlmPasswordAuthentication(
"192.168.10.229", "user", "password");
// jcifs.smb.SmbSession.getChallengeForDomain(). jcifs.smb.SmbSession.logon(dc, auth);
System.out.print( "OK");
} catch (jcifs.smb.SmbAuthException e) {
String url ="domainlogin.jsp";
String msg = e.toString();
// request.setAttribute("errMsg", "密碼或使用者名稱錯誤");
// request.getRequestDispatcher(url).forward(request, response);
// json="{result:0}"; e.printStackTrace();
} catch (jcifs.smb.SmbException e) {
e.printStackTrace();
} catch(UnknownHostException e)
{
e.printStackTrace();
}
UniAddress dc = UniAddress.getByName("192.168.10.229");
jcifs.smb.NtlmPasswordAuthentication auth =new jcifs.smb.NtlmPasswordAuthentication(
"192.168.10.229", "user", "password");
// jcifs.smb.SmbSession.getChallengeForDomain(). jcifs.smb.SmbSession.logon(dc, auth);
System.out.print(
} catch (jcifs.smb.SmbAuthException e) {
String url ="domainlogin.jsp";
String msg = e.toString();
// request.setAttribute("errMsg", "密碼或使用者名稱錯誤");
// request.getRequestDispatcher(url).forward(request, response);
} catch (jcifs.smb.SmbException e) {
e.printStackTrace();
} catch(UnknownHostException e)
{
e.printStackTrace();
}