-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
Is it possible to retrieve client window login username using zkoss ? because I need it for validation in my webapp. I already use System.getProperty("user.name") but it only get server username not the client.
pls help
Regards,
Klepon
Finally I Know how to get window login client username using 3rd Party API called Waffle. put waffle-api.jar on your project classpath. then put this xml code on your web.xml
<filter>
<filter-name>SecurityFilter</filter-name>
<filter-class>waffle.servlet.NegotiateSecurityFilter</filter-class>
<init-param>
<param-name>principalFormat</param-name>
<param-value>fqn</param-value>
</init-param>
<init-param>
<param-name>roleFormat</param-name>
<param-value>both</param-value>
</init-param>
<init-param>
<param-name>allowGuestLogin</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>securityFilterProviders</param-name>
<param-value>
waffle.servlet.spi.NegotiateSecurityFilterProvider
waffle.servlet.spi.BasicSecurityFilterProvider
</param-value>
</init-param>
<init-param>
<param-name>waffle.servlet.spi.NegotiateSecurityFilterProvider/protocols</param-name>
<param-value>
Negotiate
NTLM
</param-value>
</init-param>
<init-param>
<param-name>waffle.servlet.spi.BasicSecurityFilterProvider/realm</param-name>
<param-value>WaffleFilterDemo</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
and use below code to get your clients username ;
HttpServletRequest request = (HttpServletRequest) Executions.getCurrent().getNativeRequest();
String user = request.getRemoteUser();
for more detail you can visit :
https://github.com/dblock/waffle
regards,
Klepon
This is a common problem for all web applications cause the browser doesn't send your login name to the application server.(The main reason is security)
You can take a look to start with kerberos here:
http://stackoverflow.com/questions/12346527/how-to-implement-single-sign-on-in-a-java-ee-application
Greetz chill.
Asked: 2015-02-23 03:18:15 +0800
Seen: 43 times
Last updated: May 29 '15