jcifs的NTLMHTTP验证及所犯错误

来源:互联网 发布:木子软件 官网app 编辑:程序博客网 时间:2024/05/22 06:10


一、错误提示:0xC0000022: jcifs.smb.SmbAuthException: Access is denied

The NTLM HTTP SSO Filter that used to be included withJCIFS cannot support NTLMv2.

   1) jcifs.smb.lmCompatibility = 0 or 1: SendLM and NTLM
    2) jcifs.smb.lmCompatibility = 2: Send NTLM in both fields
    3) jcifs.smb.lmCompatibility = 3, 4, or 5: Send just LMv2

1、使用包:jcifs-1.3.14.jar

2、Eclipse的web工程中的web.xml配置:下面黑体配置,解决了错误。

<?xml version="1.0"encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaeehttp://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID"version="2.5">
<display-name>ITSystemSSO</display-name>

   <filter>
       <filter-name>WebServicesFilter</filter-name>
       <filter-class>com.channelsoft.sso.ipfilter.IpFilter</filter-class>
    </filter>   
    <filter-mapping>
        <filter-name>WebServicesFilter</filter-name>
       <url-pattern>/*</url-pattern>
    </filter-mapping>
   
   
   <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.130.1.9</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>
   <filter>
       <filter-name>DenyFilter</filter-name>
       <filter-class>com.channelsoft.sso.deny.DenyAll</filter-class>
    </filter>   
    <filter-mapping>
       <filter-name>DenyFilter</filter-name>
       <url-pattern>/*</url-pattern>
    </filter-mapping>

<welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
</welcome-file-list>
</web-app>

3、说明

http://lists.samba.org/archive/jcifs/2004-February/003069.html

http://www.ioplex.com/d/jespa/api/jespa/ntlm/NtlmSecurityProvider.html

二、错误提示:jcifs.smb.SmbException: NTLMv2 requires extendedsecurity (jcifs.smb.client.useExtendedSecurity must betrue ifjcifs.smb.lmCompatibility >=3)  

如果已经增加了上面黑体部分,则需重启tomcat服务器。

三、调试java web程序,时替换jar包,旧jar包修改名称后继续保存在\WebContent\WEB-INF\lib文件夹下,加载旧包,而没有重新加载新包。