users@glassfish.java.net

Re: Glassfish and NT login Name

From: <glassfish_at_javadesktop.org>
Date: Mon, 17 Mar 2008 09:22:41 PST

Ok. I got it. In case someone else need it:

1). Download jCIFS jar: http://jcifs.samba.org/src/
2). Add the jcifs-1.2.18.jar (the latest one) to your project.
3). Open web.xml to add the filter:
    
    <filter>
        <filter-name>NtlmHttpFilter</filter-name>
        <filter-class>jcifs.http.NtlmHttpFilter</filter-class>
        <init-param>
            <param-name>jcifs.http.domainController</param-name>
            <param-value>YOUR WIN'S DOMAIN or IP</param-value>
        </init-param>
    </filter>

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


In your back beans, or servlet, you can use this code to get the NT login name:

For me, JSF: String ntName = FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
[Message sent by forum member 'jimmyx2000' (jimmyx2000)]

http://forums.java.net/jive/thread.jspa?messageID=264422