I'm running Tomcat 7
on Windows 7
. All clients are running Windows 7
too .
I'm trying to print the client username on a test.jsp
page so I use Waffle
. Here is the WEB-INF/web.xml
<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class>
<init-param>
<param-name>impersonate</param-name>
<param-value>true</param-value>
</init-param>
</filter>
Here is my test.jsp
<%
String userId = Secur32Util.getUserNameEx(Secur32.EXTENDED_NAME_FORMAT.NameSamCompatible);
out.println(userId);
%>
However it always prints the server
computer username . I tried it on many client
machines, and it always printed the server
but not the client
userid
Why? How to correct this?
The magic is:
$pageContext.request.remoteUser
First, put waffle-api.jar on your project classpath. then put this xml code on your web.xml.
and use below code to get your clients username ;
for more detail you can visit :
https://github.com/dblock/waffle
Credit Goes to klepon
Resource Link: