在Java EE Web应用程序中检索当前Windows用户以进行单点登录 [英] Retrieve current Windows user in Java EE web application for Single Sign On purposes

查看:308
本文介绍了在Java EE Web应用程序中检索当前Windows用户以进行单点登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个需要使用Active Directory进行单点登录的Java EE Web应用程序。

I am doing a Java EE web application that requires Single Sign On with Active Directory.

应用程序将不再提示输入用户名和密码。身份验证过程需要检索当前Windows登录用户。一旦我有了用户,我需要查询Active Directory以获取该登录用户的角色。我知道这将排除非Windows用户,但这是一个内部应用程序,所有客户端都使用Windows。

The application will no longer prompt for a username and password. The authentication process would require retrieval of the current Windows logged on user. Once I have the user, I need to query Active Directory to get the roles for that logged on user. I am aware that this will exclude non-Windows users, but this is an internal application and all clients are using Windows.

我必须在2 Java EE中实现SSO Web应用程序。 1个应用程序在GlassFish v2.1.1(JDK 1.6)上运行,另一个在Tomcat(JDK 1.5)上运行。

I have to implement the SSO in 2 Java EE web applications. 1 application is runnning on GlassFish v2.1.1 (JDK 1.6) and the other is running on Tomcat (JDK 1.5).

基本上我的主要问题是如何检索当前Windows登录用户。

Basically my main problem is how to retrieve the current Windows logged on user.

我已经来了跨 JAAS 和< a href =http://docs.oracle.com/javase/7/docs/technotes/guides/security/jgss/tutorials/KerberosReq.html\"rel =nofollow noreferrer> Kerberos 。如果我错了,请纠正我。我的理解是这些是身份验证协议,它们没有检索登录用户的当前窗口的功能。

I've already come across JAAS and Kerberos. Kindly correct me if I'm wrong. My understanding is that these are authentication protocol and they do not have the feature to retrieve the current windows logged on user.

我已经尝试了以下但我总是获取 null 或服务器自己的用户名。

I've already tried the following but I am always getting null or Server's own username.


  1. 系统。 getProperty(user.name);

  2. new com.sun.security.auth.module.NTSystem()。getName( );

  3. request.getUserPrincipal()。getName();

  4. System.getenv(USERNAME);

  5. Tomcat中的JCIF NTLM HTTP身份验证

  6. LoginContext

  1. System.getProperty("user.name");
  2. new com.sun.security.auth.module.NTSystem().getName();
  3. request.getUserPrincipal().getName();
  4. System.getenv("USERNAME");
  5. JCIF NTLM HTTP Authentication in Tomcat
  6. LoginContext

我愿意接受任何建议。

推荐答案

WAFFLE 是一个很好的解决方案。它不需要Kerberos配置。

WAFFLE is a great solution for this. It does not need Kerberos configuration.

这篇关于在Java EE Web应用程序中检索当前Windows用户以进行单点登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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