星期五, 10月 02, 2009

JCIFS NTLM HTTP 認證設定範例

今天試了Railo,接下來要設定NTLM認證,Google JCIFS NTLM 範例,第一筆居然是小弟的Blog... 看來沒有別人貼出來。

只好自己做,基本上還是參考JCIFS NTLM HTTP Authentication,下載jCIFS的jar放到lib目錄,再修改web.xml,在<web-app>的區段內放入
<filter>
    <filter-name>NtlmHttpFilter</filter-name>
    <filter-class>jcifs.http.NtlmHttpFilter</filter-class>
    
    <init-param>
        <param-name>jcifs.netbios.wins</param-name>
        <param-value>your wins server ip</param-value>
    </init-param>
    
    <init-param>
        <param-name>jcifs.smb.client.domain</param-name>
        <param-value>your domain name</param-value>
    </init-param> 
    
        <init-param>
        <param-name>jcifs.smb.client.username</param-name>
        <param-value>real user name</param-value>
    </init-param>
    
    <init-param>
        <param-name>jcifs.smb.client.password</param-name>
        <param-value>real password</param-value>
    </init-param>
    
</filter>

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

秘訣就在於要用WINS而不是AD,還要放一個username及password,沒有仔細看原文就會怎麼試也不成功,收工!

沒有留言: