1、NTLM can be done with JCIFS and without HTTP. Only a few lines of code are required in the code of your servlet:
InetAddress ip = InetAddress.getByName(”192.168.0.1.”); // ip address of your windows controller
UniAddress myDomain = new UniAddress(ip);
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(”MYDOMAIN”, “mylogin”, “mypasword”);
SmbSession.logon(myDomain, auth);
If an exception is triggered, the controller didn’t like the login and the password
2、Http方式下web.xml中filter的配置:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>WEB APP</display-name>
<description>WEB APP description</description>
<servlet>
<servlet-name>ShowRequestHeaders</servlet-name>
<servlet-class>coreservlets.ShowRequestHeaders</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>ShowRequestHeaders</servlet-name>
<url-pattern>/ShowRequestHeaders</url-pattern>
</servlet-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>192.168.10.1</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>NtlmHttpFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
posted on 2005-08-19 11:06
my java 阅读(1126)
评论(0) 编辑 收藏 所属分类:
java