jcifs技术实现单点登录
http://jcifs.samba.org/
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort();
String remoteuser = request.getRemoteUser();
String url = basePath +"/xxxSystem/welcome_desk.jsp?remoteuser="+remoteuser;
response.sendRedirect(url);
%>
---------------------------------------------------------------------------------------------
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>NtlmHttpFilter</filter-name>
<filter-class>jcifs.http.NtlmHttpFilter</filter-class>
<init-param>
<param-name>jcifs.http.domainController</param-name>
<param-value>10.1***</param-value>
</init-param>
<init-param>
<param-name>jcifs.smb.lmCompatibility</param-name>
<param-value>0</param-value>
</init-param>
<init-param>
<param-name>jcifs.smb.client.useExtenededSecurity</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>jcifs.smb.client.soTimeout</param-name>
<param-value>35000</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>NtlmHttpFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
---------------------------------------------------------------------------------------------
请先下载 jcifs-1.3.15.jar
須隔开project,否则会有问题。
1。首先从http://jcifs.samba.org 这个站点下载 jcifs-1.3.2.jar包。
2。把这个包放到相应的lib文件下面。
3。对web.xml文件进行配置,添加如下内容
<filter>
<filter-name>NtlmHttpFilter</filter-name>
<filter-class>jcifs.http.NtlmHttpFilter</filter-class>
<!--jcifs.http.domainController 这个参数指定了DNS服务器的地址-->
<init-param>
<param-name>jcifs.http.domainController</param-name>
<param-value>192.168.1.206</param-value>
</init-param>
<!--jcifs.netbios.wins 这个参数也指定了DNS服务器的地址
The WINS server 192.168.1.206 will be queried domain controller.
If that WINS server is not responding, 192.168.1.207 will be queried.-->
<!--
<init-param>
<param-name>jcifs.netbios.wins</param-name>
<param-value>192.168.1.206,192.168.1.207</param-value>
</init-param> -->
<!--jcifs.smb.client.domain 这个参数指定了DNS服务器上面的域名-->
<init-param>
<param-name>jcifs.smb.client.domain</param-name>
<param-value>DLHT</param-value>
</init-param>
<!--jcifs.util.loglevel
0: Nothing
1: Critical [default]
2: Basic info. (Can be logged under load)
3: Detailed info. (Highest recommended level for production use)
4: Individual smb messages
6: Hex dumps
-->
<init-param>
<param-name>jcifs.util.loglevel</param-name>
<param-value>0</param-value>
</init-param>
<!--下面这两个参数是针对windows 2003服务器来设定.
这里的用户名必须是DNS服务器上面的用户名和密码
you provide init-parameters for the jcifs.smb.client.{domain,username,password}
properties to perform "preauthentication" for each transport to a domain contoller
so that a proper SMB signing key can be generated.
-->
<init-param>
<param-name>jcifs.smb.client.username</param-name>
<param-value>xxxx</param-value>
</init-param>
<init-param>
<param-name>jcifs.smb.client.password</param-name>
<param-value>c!23456</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>NtlmHttpFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
4。要对你的DNS服务器添加NetBIOS协议。
5。对你的IE进行设置,自动使用当前用户名和密码登录。
6。用request.getRemoteUser();来获取当前登录的用户名。
通过对上面的配置以后,你就可以用当前配置 域中的用户进行登录了。
有什么地方写的不清楚,可以共同讨论。QQ:674706446
login.jsp 登录页面
<%@ page contentType="text/html;charset=gbk" %>
<%
//String userId = request.getParameter("userId");
String userId = request.getRemoteUser();
userId = userId.substring(userId.indexOf("\\") + 1);
//passwordFlg 为单点登录标志 0为单点登录,1为正常登录
String str = "/ClientEnter?ClientEnter=" + userId + "&passwordFlg=0";
response.sendRedirect(str);
%>
一个企业内联网网站上常见的需求是NTLM HTTP认证有时也被称为单点登录(SSO)。微软IE浏览器的能力,谈判通过HTTP使用Base 64编码NTLMSSP消息会话使用NTLM密码散列。这是一个Java应用程序的IIS,但也可以使用jCIFS来验证客户端的域控制器MSIE主食服务器功能。这是一个有用的功能,因为周围的用户管理,现在回落到电脑支持和人力资源的许多任务。这是没有必要添加和删除用户,因为他们加入和离开公司。也许最重要的,从用户的角度来看,他们并不需要输入用户名和密码,如果他们的工作站是域的成员。时产生的密码哈希他们登录到自己的工作站将在通过jCIFS通过了会议,初步要求谈判,并针对PDC或BDC验证。这也使得用户的网域,用户名和密码管理会话的信息,特征,喜好等使用jCIFS Servlet过滤器是微不足道的HTTP验证的支持NTLM身份加入到您的网站上。它也可以创建自定义身份验证模块使用NtlmSsp类直接。这个过滤器尺度非常好,主要是因为会话是在复用传输。但是,这个功能也不是没有警告。
注:此功能是一个非符合性扩展到HTTP完全由微软设想。它不适当地使用HTTP标头,因此可能无法在所有servlet容器或服务器可能会停止使用您的应用程序的新版本。同时,这个密码是加密的味道不是很安全的情况下,不应该如此它是用来验证Internet客户端上。
注意:不要忘记重启参数改变后jCIFS容器初始化。 JCIFS必须使用容器类加载器和jCIFS属性是只读一次当jCIFS类被初始化。
安装和设置
latest jCIFS jar把最新的jCIFS罐子lib文件在/]你的webapp目录[1。由于jCIFS属性加载一次,当jCIFS类是首次访问,是要真正停止并重新启动容器如有jCIFS属性已被更改。下面是两个web.xml中配置。请注意,jcifs.smb.client.domain和jcifs.smb.client.domainController属性是互相排斥的。
生产的web.xml示例
一个简约的映射指令web.xml文件过滤器和过滤器可能类似于以下内容:
<filter>
<filter-name> NtlmHttpFilter </过滤器的名称>
<filter-class> jcifs.http.NtlmHttpFilter </过滤器类>
<init-param>
<param-name> jcifs.smb.client.domain </的param - name>
<param-value>纽约用户</参数值>
</的init - param>
<init-param>
<param-name> jcifs.netbios.wins </的param - name>
<param-value> 10.169.10.77,10.169.10.66 </参数值>
</的init - param>
</滤镜“>
<filter-mapping>
<filter-name> NtlmHttpFilter </过滤器的名称>
的<url-pattern> / *“/的url - pattern>
</过滤器映射>
该过滤器部分说明了在用户安装程序,验证客户对域纽约市。这是适合用户的并发数为jCIFS大循环将通过域控制器,并使用WINS服务器候补委员必要的。
上述将验证用户访问所有用户的内容针对域纽约市。 WINS服务器10.169.10.77将被查询来解决纽约市的用户到域控制器的IP地址对。如果该WINS服务器没有响应,10.169.10.66将被质疑。
备用的web.xml示例
下面的例子节滤波器illistrates如何指定jcifs.http.domainController财产IP地址的域控制器特别使用。目标计算机并不需要一个真正的域控制器 - 这可能只是一个工作站。也说明了下面是jcifs.smb.client.logonShare财产。这将导致jCIFS试图访问资源\ \ 192.168.2.15 \ JCIFSACL当用户进行身份验证。通过创建,共享和更改访问控制列表只有特定的用户或用户组可以访问您的网站。
<filter> <filter-name> NtlmHttpFilter </过滤器的名称> <filter-class> jcifs.http.NtlmHttpFilter </过滤器类> <init-param> <param-name> jcifs.http.domainController </参数,名称> <param-value> 192.168.2.15 </参数值> </的init - param> <init-param> <param-name> jcifs.smb.client.logonShare </参数名称> <param-value> JCIFSACL </参数值> </的init - param> </滤镜“> <filter-mapping> <filter-name> NtlmHttpFilter </过滤器的名称>的<url-pattern> / *”/的url - pattern> </过滤器映射>
该过滤器部分说明了并发用户的身份验证设置为JCIFSACL反对份额数测试或小的网站上(如1000)
要么是jcifs.smb.client.domain或jcifs.smb.client.domainController属性是必需的。这将是合适的身份验证的客户端指定域的成员以及其他领域与它有信任关系。
运行NtlmHttpAuthExample.java例子应该是筛选合适的测试。
使用NTLM HTTP认证范例
纽约市的用户\ MIALLEN成功登录
请提交某种形式使用POST数据
<!--[if gte vml 1]><v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"> <v:stroke joinstyle="miter"/> <v:formulas> <v:f eqn="if lineDrawn pixelLineWidth 0"/> <v:f eqn="sum @0 1 0"/> <v:f eqn="sum 0 0 @1"/> <v:f eqn="prod @2 1 2"/> <v:f eqn="prod @3 21600 pixelWidth"/> <v:f eqn="prod @3 21600 pixelHeight"/> <v:f eqn="sum @0 0 1"/> <v:f eqn="prod @6 1 2"/> <v:f eqn="prod @7 21600 pixelWidth"/> <v:f eqn="sum @8 21600 0"/> <v:f eqn="prod @7 21600 pixelHeight"/> <v:f eqn="sum @10 21600 0"/> </v:formulas> <v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"/> <o:lock v:ext="edit" aspectratio="t"/> </v:shapetype><v:shape id="_x0000_i1025" type="#_x0000_t75" style='width:1in; height:18pt'> <v:imagedata src="file:///C:\DOCUME~1\yuzeyang\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.wmz" o:title=""/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]--><!--[if gte vml 1]><v:shape id="_x0000_i1026" type="#_x0000_t75" style='width:62.25pt;height:20.25pt'> <v:imagedata src="file:///C:\DOCUME~1\yuzeyang\LOCALS~1\Temp\msohtmlclip1\01\clip_image003.wmz" o:title=""/> </v:shape><![endif]--><!--[if !vml]--><!--[endif]-->
field1的=你好
测试意义的文章中,经过协商NTLM身份验证的HTTP一次,即不会发表任何形式的数据,直到它再次谈判的密码哈希。
如果NTLM身份验证的HTTP筛选器未启用像下面这样将显示:
空成功登录
请注意,用户被允许访问。不像这个例子中,开发人员可能会增加一个额外的检查,以确保getRemoteUser没有返回 null。
非MSIE客户,并且“基本”身份验证
使用NTLM HTTP认证只支持MSIE透明。Integrated Authentication Mozilla的1.6支持NTLM HTTP的谈判,但始终提示用户通过默认凭据(虽然在Mozilla的文档集成身份验证描述如何使其透明的,用户信任的网站)。对于其他客户有可能通过使用基本身份验证使用NTLM密码凭据。这是非常气馁,如果没有使用SSL的,因为它以纯文本发送这些凭据。它不会很难另一个用户下载并安装一个程序来“窥探”LAN流量并获得其他用户的密码。
无论如何,这一功能已被添加到NtlmHttpFilter和NtlmServlet(适用于2.3 servlet容器),尽管它是默认禁用。要启用此功能设置jcifs.http.basicRealm,jcifs.http.enableBasic,及下表中所述的jcifs.http.insecureBasic性能。
JCIFS属性有意义为NTLM HTTP认证
开头的所有参数'jcifs。' 将被设置为jCIFS属性这意味着任何jCIFS属性可以作为初始化参数。必须设置这些属性之前jCIFS类使用。overview page of the API documentation对于jCIFS属性的完整清单请参考API文档概述页。这里是一个jCIFS与HTTP认证的NTLM方面的补充说明属性子集选择。
jcifs.smb.client.domain jcifs.smb.client.domain |
The NT domain against which clients should be authenticated. NT域对哪些客户端进行身份验证。Generally it is necessary to also set the parameter or a domain controller may not be found.一般来说,有必要也设置jcifs.netbios.wins参数或域控制器可能无法找到。This parameter will be ignored for NTLM HTTP authentication purposes if a property is specified (although they can be used together for "preauthenctication" as described in the SMB Signatures and Windows 2003 section below).这个参数将被忽略NTLM身份验证目的的HTTP如果jcifs.http.domainController属性被指定(虽然他们可以一起使用的“preauthenctication”作为描述的SMB签名和Windows 2003部分)。 |
jcifs.http.domainController jcifs.http.domainController |
The IP address of any SMB server that should be used to authenticate HTTP clients with the class.该NtlmHttpFilter类IP地址的任何SMB服务器,应使用HTTP客户端的身份验证与。If this is not specified the 0x1C NetBIOS group name will be queried.如果这不是指定的jcifs.smb.client.domain 0x1C进行NetBIOS组名称将被质疑。If these queries fail an will be thrown.如果这些查询失败,将抛出一个UnknownHostException。It is not necessary for this to specify a real domain controller.这是没有必要为此指定一个真正的域控制器。The IP address of a workstation will do for simple purposes.工作站的IP地址将做简单的目的。 |
jcifs.http.basicRelm jcifs.http.basicRelm |
The realm for basic authentication.对于基本身份验证领域。This property defaults to 'jCIFS'.此属性默认为'jCIFS'。 |
jcifs.http.enableBasic jcifs.http.enableBasic |
Setting this property to enables basic authentication over HTTPS only.设置此属性,以使真正的HTTPS仅基本身份验证了。 |
jcifs.http.insecureBasic jcifs.http.insecureBasic |
Setting this property to enables basic authentication over plain HTTP.设置此属性,以使真正的纯HTTP基本验证了。This configuration passes user credentials in plain text over the network.这种配置在网络中传递明文用户凭据。It should not be used in environment where security is required.它不应该被用在环境中的安全是必需的。 |
jcifs.http.loadBalance jcifs.http.loadBalance |
If a property is specified (and is not specified) the will query for domain controllers by name.如果jcifs.smb.client.domain属性被指定(及加入DomainController不指定)NtlmHttpFilter将名称查询由域控制器。If this property is the Filter will rotate through the list of domain controllers when authenticating users.如果此属性为 true过滤器将通过旋转控制器列表用户进行身份验证时的域。The default value is .默认值是 true。The property can also be used to limit the number of domain controllers used.该jcifs.netbios.lookupRespLimit属性也可用于限制使用的数字控制器的域。 |
jcifs.netbios.lookupRespLimit jcifs.netbios.lookupRespLimit |
The 0x1C NetBIOS name query returns a list of domain controllers.该0x1C进行NetBIOS名称查询返回的域控制器列表。It is believed that the servers at the top of this list should be favored.据信,在此列表的顶部的服务器应该受到青睐。This property limits the range of servers returned by name queries.此属性限制按名称查询返回的服务器范围。The default value is 5 meaning the top 5 domain controllers will be used.默认值是5的意思前5个域控制器将被使用。 |
jcifs.netbios.wins jcifs.netbios.wins |
The IP address of the WINS server.的WINS服务器的IP地址。This is required when accessing hosts on different subnets (like a domain controller by name) and it is highly recommended if a wins server is available.这是访问时需要在不同子网上的主机(如按名称域控制器),这是强烈建议如果WINS服务器可用。 |
jcifs.smb.client.laddr jcifs.smb.client.laddr |
The ip address of the local interface the client should bind to if it is different from the default.本地接口的IP地址绑定到客户端应该如果它不同于默认。For example if jCIFS is used to authenticate clients on one interface and the domain controller for those clients is accessible only on another interface of a webserver with two NICs it may be necessary to specify which interface jCIFS should use.例如,如果jCIFS用于验证在一个接口以及这些客户的客户是唯一的域控制器的另一个Web服务器有两个网卡接口访问它可能需要指定应该使用哪个接口jCIFS。 |
jcifs.netbios.laddr jcifs.netbios.laddr |
The ip address of the local interface the client should bind to for name queries if it is different from the default.本地接口的IP地址的客户端应为名称查询绑定到如果它不同于默认。Likely set to the same as the above property.可能设置为与上述性质相同。 |
jcifs.smb.client.attrExpirationPeriod jcifs.smb.client.attrExpirationPeriod |
Attributes of a file are cached for milliseconds.文件属性的是缓存attrExpirationPeriod毫秒。The default is 5000 but the servlet will attempt to set this property to 120000.默认是5000,但NetworkExplorer servlet将尝试将此属性设置为120000。Otherwise, when listing large directories, the attributes of may expire within the default period resulting in a large number of additional network messages and severe performance degradation.否则,当上市的大型目录,属性的SmbFiles内到期的可降解性能的默认和严重的时期产生了大量额外的网络信息。 |
jcifs.smb.client.soTimeout jcifs.smb.client.soTimeout |
To prevent the client from holding server resources unnecessarily, sockets are closed after this time period if there is no activity.为了防止不必要的客户端服务器资源控股,插座被关闭后,这段时间内如果没有任何活动。This time is specified in milliseconds.这一次,被指定以毫秒为单位。The default is 15000 however when NTLM HTTP Authentication is used, the will attempt to set this value to 5 minutes so that frequent calls to do not provoke redundant messages being submitted to the domain controller.但是默认是15000当NTLM HTTP认证使用,NtlmHttpFilter将尝试将此值设置为5分钟,使()经常呼吁SmbSession.logon不要惹冗余消息被提交到域控制器。If it is not desirable to cache password hashes set this value back to 15000.如果它是不可取的密码哈希缓存设置此值回15000。 |
jcifs.netbios.cachePolicy jcifs.netbios.cachePolicy |
When a NetBIOS name is resolved with the NbtAddress class it is cached to reduce redundant name queries.当一个NetBIOS名称与NbtAddress类是解决缓存以减少重复名称查询。This property controls how long, in seconds, these names are cached.此属性控制多久,在几秒钟内,这些名称缓存。The default is 30 seconds, 0 is no caching, and -1 is forever.默认为30秒,0是没有缓存,-1是永恒的。When NTLM HTTP Authentication is used, will attempt to set this value to 20 minutes so that frequent queries for a domain controller will be cached.当NTLM HTTP认证使用,NtlmHttpFilter将尝试将此值设置为20分钟,使该域控制器为频繁的查询将被缓存。 |
如果您更改任何jcifs属性或更换一个不同的现有jcifs jar文件,容器必须重新启动。这是因为大多数jcifs属性检索类只有一次,当第一次加载。
Tomcat的
Tomcat的过滤指令要求所有彼此相邻,所有过滤器映射指令出现彼此相邻,所有servlet指令... 等等。这是因为Tomcat对验证的DTD的web.xml部署描述符。
MalformedURLException:未知协议:中小企业
如果你得到下面的异常尝试升级到jcifs - 0.7.0b12或更高版本。FAQ另请阅读常见问题。
例外MalformedURLException:未知协议:中小企业
在中java.net.URL(URL.java:480)。
在中java.net.URL(URL.java:376)。
在中java.net.URL(URL.java:330)。
在jcifs.smb.SmbFile(SmbFile.java:355)。
...
如果过滤器正常工作的网络密码对话框应该永远不会出现。但是,必须有一个Web浏览器开会商讨透明使用NTLM认证的HTTP authenication几个要求。如果任何这些要求得不到满足,默认的行为是目前与用户的网络密码对话框。的要求是:
<!--[if !supportLists]-->1. <!--[endif]-->客户端必须登录到Windows NT的jcifs.smb.client.domain参数(或参数标识的jcifs.smb.client.domainController如果用它代替主域)确定域。客户端可以被记录到域具有与目标域的信任关系。事实上,这并非罕见配置工作站加入一个从用户的不同领域。请注意,Windows 95/98/ME系统不能真正加入域,但可以这样做配置足够透明的NTLM身份参加HTTP认证。
<!--[if !supportLists]-->2. <!--[endif]-->只有Internet Explorer将使用NTLM HTTP认证透明的谈判。 Mozilla将总是提示用户输入凭据(某人请通知我们,当/如果这是不是真的了)。当时写这本FAQ不知道还有哪些浏览器,如果有的话,可以协商NTLM身份的HTTP authenication透明。
<!--[if !supportLists]-->3. <!--[endif]-->无论是目标URL必须包含本地域中(例如ws1.mycompany.com)或客户端的安全设置的服务器必须被改变(如工具>“Internet选项”>安全“本地Intranet>网站>”高级>“添加您的网站)。如果URL中不包含在定义的Intranet区域(如不是一个IP地址)的网址,IE浏览器将假定服务器在Internet区域和目前与用户的网络密码对话框。这将是一个非常不好,如果互联网上的服务器能够说服IE浏览器发送给您的使用NTLM密码散列。这些都是很容易与蛮力破解哈希字典攻击。为了防止这种情况下,IE浏览器试图区分内部网站和互联网网站。下面是一些重要事项时需要考虑部署一个使用NTLM HTTP认证的网站,无论是否jCIFS是用来做它。
<!--[if !supportLists]-->o <!--[endif]--> Internet Explorer可能会提示您输入密码
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q258063http://support.microsoft.com/default.aspx?scid=kb;恩美; Q258063
<!--[if !supportLists]-->o <!--[endif]-->如何使用Internet Explorer安全区域
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q174360http://support.microsoft.com/default.aspx?scid=kb;恩美; Q174360
<!--[if !supportLists]-->o <!--[endif]--> Intranet网站被标识为一个互联网网站时,你使用FQDN或IP地址
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q303650http://support.microsoft.com/default.aspx?scid=kb;恩美; Q303650
<!--[if !supportLists]-->4. <!--[endif]-->用户的凭据必须是有效的。例如,如果该帐户已过期,被禁用或锁定网络密码对话框将会出现。要确定哪些错误有过错,有必要修改NtlmHttpFilter检查中的doFilter SmbAuthException。
<!--[if !supportLists]-->5. <!--[endif]-->该jCIFS客户端必须支持lmCompatibility水平与域控制器的通信需要。如果服务器不允许NTLMv1尝试设置jcifs.smb.lmCompatibility = 3。
如果您的Active Directory安全政策要求用户只能从他们的JCIFS到个人工作站将无法登录到域验证和服务器的安全日志将有类似“\ \ JCIFS10_40_4A无法授权”的条目。这是因为域控制器是未能有效解决动态生成的“来电姓名”,由客户端提交的协议协商过程中。为了解决这个问题,有必要设置jcifs.netbios.hostname属性为有效的NetBIOS名称都可以)解决NetBIOS名称服务(如WINS和补充,更名为许可客户端AD安全政策。
例如,您可以使用此属性设置为HTTP的web.xml文件的NTLM一个INIT - paremeter过滤器如下:
<init-parameter>
<parameter-name> jcifs.netbios.hostname </参数名>
<parameter-value> MYHOSTNAME </参数值>
</ init的参数>
一旦谈判NTLM身份IE的HTTP验证它会主动重新谈判与服务器相关的所有内容POST请求的NTLM(基于IP的?)。因此,当使用HTTP POST请求是不可能限制访问服务器上的一些内容,IE浏览器将尝试,不谈判的NTLM(标准的IE错误页?)。这是协议限制,似乎没有被说服IE浏览器的方式主动停止POST请求一旦谈判已确定该服务器是NTLM身份验证的谈判能力。
中小企业签名和Windows 2003
如果域控制器,你对客户的需要进行身份验证的SMB签名(Windows 2003中默认是通过),建议您提供的init - jcifs.smb.client参数的。{域,用户名,密码}执行“预身份验证”每到一个域位指示运输,使正确的SMB签名的密钥将被生成。事实上,这可能是正确的操作必需,它已被观察到的NT 4.0不检查认证的要求,但该行为并未在所有环境中证实了签名。如果过滤工程,第一个身份验证失败,但第二个用户此后不久,这将表明,签约成立认证失败了,但随后由于缺乏关键的一个好签。另外,没有适当的签名密钥SMB_COM_LOGOFF_ANDX)若干请求(SMB_COM_TREE_DISCONNECT,将导致签名验证失败(尽管它们是无害的客户端)。
一个签字问题解决方案,第三是改变jcifs.smb.client.ssnLimit为1。这就要求每一个身份验证使用一种单独的传输。因为Mac签名密钥仅在SMB通信中使用后发生的初始身份验证,签署将有效地忽略。然而,这个解决方案将大大减少,因为每个验证可扩展性,开放它自己的交通工具。对于这是否使用“工作站的帐户”,preauthenticate运输第二个解决方案被认为是优越的方法,并应在默认情况下用于服务器,需要签名的原因。
使用NTLM HTTP认证协议详细
在NTLM HTTP认证过程很好地描述这些文件:
http://davenport.sourceforge.net/ntlm.htmlhttp://davenport.sourceforge.net/ntlm.html
http://www.innovation.ch/java/ntlm.htmlhttp://www.innovation.ch/java/ntlm.html
这一过程可以概括为三请求/响应“握手”。所以的doGet()会被调用三次。第一个是最初的请求。401未经授权被送回被IE提交一个特殊的信息编码在一个头。另401未经授权被送回后IE浏览器提交的密码哈希。这是jCIFS用武之地的密码哈希仅是无用的。你必须检查自己的服务器上对密码数据库的真实性地方(其实你可以指定一个普通的工作站或任何其他SMB服务器的IP)。否则用户谁的工作站不是域将得到一个密码对话框成员到他们可以把任何东西,这将让他们进来,这就是几乎所有的例子,在各种论坛上看到做。不要被愚弄。
[1]由于被加载到协议的限制,如何处理,如果SMB URL协议处理程序是使用(意思是你要访问资源与SMB中小企业:/ /网址)在您的应用程序是必要的罐子被jCIFS加载系统类加载器。这通常可以达到目录中放置在容器中库/。然而,对于容器(Tomcat)的servlet类加载在子类加载器这也将可能会带来问题jCIFS将无法加载javax.servlet包.*类。为了得到过滤和URL协议处理程序同时运行,需要一些试验和使用取决于容器的福利。