检测用户登录使用Java Web应用程序的计算机上 [英] Detect user logged on a computer using Java web app

查看:168
本文介绍了检测用户登录使用Java Web应用程序的计算机上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想开发一个Java应用程序,可以检测到用户登录一个窗口域。这些凭证将要用来登录Tomcat上运行的Java应用程序。

I want to develop an Java application that can detect the user logged on a Window Domain. These credentials are going to be used to logging on the Java application running on Tomcat.

我怎样才能做到这一点?我想知道我的访问的web应用程序的远程用户。该用户登录一个活动目录

How can I do this? I want to know the remote user accessing my web app. This user is logged on a active directory

谢谢!

推荐答案

这是我的解决方案:

将JCIFS-1.2.7.jar上[TOMCAT_HOME] / common / lib目录。

Put jcifs-1.2.7.jar on [TOMCAT_HOME]/common/lib directory.

修改应用程序的web.xml中添加跟随着文字部分web应用:

Modify application's web.xml adding the followin text to section webapp:

<filter>
    <filter-name>NtlmHttpFilter</filter-name>
    <filter-class>jcifs.http.NtlmHttpFilter</filter-class>
    <init-param>
        <param-name>jcifs.http.domainController</param-name>
        <param-value>xx.xx.xx.xxx</param-value>  --> Domain Controller IP
    </init-param>
    <init-param>
        <param-name>jcifs.util.loglevel</param-name>
        <param-value>2</param-value>
    </init-param>
  </filter>
  <filter-mapping>
       <filter-name>NtlmHttpFilter</filter-name>
       <url-pattern>/*</url-pattern>
  </filter-mapping>

而你可以使用request.getRemoteUser()远程用户提示内部消除

And the you can get the remote user using request.getRemoteUser() whithout prompt.

见你。

这篇关于检测用户登录使用Java Web应用程序的计算机上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆