[jcifs] Help regarding Windows Authentication

vardhaman narasagoudar vardhamanbn at gmail.com
Mon Nov 5 04:33:18 GMT 2007


Hello,

    I am trying for windows authentication such that a pop -up windows comes
and ask for username and password of the system and also should be able to
get the remote username(System Name). Please help me I have been trying for
past 3 weeks.I am trying this on Tomcat 5.5 + Struts/JSP.

I also referred this site http://jcifs.samba.org/src/docs/ntlmhttpauth.html.I
followed the steps that is I

1. downloaded jcifs-1.1.11.jar and placed it in lib folder of the
application.

2. I copied the following code and modified and placed it in web.xml of the
application.
<filter>
    <filter-name>NtlmHttpFilter</filter-name>
    <filter-class>jcifs.http.NtlmHttpFilter</filter-class>

    <init-param>
        <param-name>jcifs.netbios.wins</param-name>
        <param-value> 192.168.1.20</param-value>
    </init-param>
    <init-param>
        <param-name>jcifs.smb.client.domain</param-name>
        <param-value>NYC-USERS</param-value>
    </init-param>
    <init-param>
        <param-name>jcifs.smb.client.username </param-name>
        <param-value>somenycuser</param-value>
    </init-param>
    <init-param>
        <param-name>jcifs.smb.client.password</param-name>
        <param-value>AReallyLoooongRandomPassword</param-value>
    </init-param>
</filter>

<filter-mapping>
    <filter-name>NtlmHttpFilter</filter-name>
    <url-pattern>/*</url-pattern>
</filter-mapping>

 but I am encountering this problem.

*exception*

java.net.UnknownHostException
: NYC-USERS
	jcifs.netbios.NameServiceClient.getAllByName(NameServiceClient.java:292)

	jcifs.netbios.NbtAddress.getAllByName
(NbtAddress.java:451)
	jcifs.smb.SmbSession.getChallengeForDomain(SmbSession.java:95)

	jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:123)

. Also I   had seen this code  that you suggested in the form:

<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.1.20</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>NtlmHttpFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

 I tried adding this , when i type the url I get a pop-up window comes and
ask for username and password I tried giving system username and password
but in vain. Also I tried giving username and password present in
tomcat-users.xml, this to did not work out. Please guide me and also how can
I read the username /System name of the client who will be accessing the
site. So somewhere I can compare that with database(present or not).

Looking forward for your reply.Please if possible send me steps from basic.

-- 
Thanks & Regards
Vardhaman B.N
9945840928
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the jcifs mailing list