0

Get Clients Username

asked 2015-02-23 03:18:15 +0800

kleponboy gravatar image kleponboy flag of Indonesia
54 5
http://stupidprogrammers....

updated 2015-02-23 03:52:18 +0800

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

delete flag offensive retag edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2015-05-29 06:30:13 +0800

kleponboy gravatar image kleponboy flag of Indonesia
54 5
http://stupidprogrammers....

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

link publish delete flag offensive edit
1

answered 2015-02-23 08:40:00 +0800

chillworld gravatar image chillworld flag of Belgium
5367 4 9
https://github.com/chillw...

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.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2015-02-23 03:18:15 +0800

Seen: 43 times

Last updated: May 29 '15

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More