检索登录Windows用户(ActiveDir)在JSF2应用(Glassfish的) [英] Retrieve logged on Windows User (ActiveDir) in JSF2 Application (Glassfish)

查看:244
本文介绍了检索登录Windows用户(ActiveDir)在JSF2应用(Glassfish的)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有上找出故障什么先进设备,先进/获取当前登录的登录名用户在我的应用标准的解决方案。通过登录,我的意思是(Windows)中-Username登录正在使用applciation在客户端上。这将在Intranet环境中运行的。

i'm currently having trouble on finding out what the state-of-the-art/standard-solution for getting the login-name of the currently signed on user in my application. By login, i mean the (Windows)-Username logged on on the client that is using the applciation. It will run only in an intranet environment.

我使用的是Windows服务器环境下,采用Glassfish的部署我JSF2应用中。

I'm using a Windows Server Environment, using Glassfish for deploying my JSF2-Application.

我发现至今都关于华夫格,JCIFS和SPNEGO建议。所有我能找到关于华夫格和Glassfish似乎是要么出日期的,或<一href="https://github.com/dblock/waffle/blob/master/Source/JNAWindowsAuthProvider/src-test/waffle/servlet/NegotiateSecurityFilterTests.java"相对=nofollow>不能再找到。难道我只是搜索错了,还是有真的没有教程如何配置WAFFLE与Glassfish的使用? JCIFS,至于我读不支持了。 SPNEGO有一个教程Glassfish的,但说实话,我不能跟着它,无法reporduce所有步骤。很显然,在验证机制的一些背景知识 - 我没有 - 将是有益的。

What i found so far are suggestions regarding WAFFLE, jCIFS and SPNEGO. All i could find out about WAFFLE and Glassfish seems to be either out of date, or can't be found anymore. Did i just search wrong or are there really no "tutorials" how to configure WAFFLE for use with Glassfish? jCIFS, as far as i read isn't supported anymore. SPNEGO has a tutorial for Glassfish, but to be honest, i couldn't follow it and wasn't able to reporduce all the steps. Obviously, some background knowledge on authentication mechanisms - which i don't have - would be helpful.

所以,现在我希望,因为大多数的信息,我发现关于这个话题至少有1,5岁,自那之后一些新的东西又拿出了解决我的问题。如果没有,那么这将是您的建议?因为我已经写了一些PHP的应用程序之前,在那里我能得到的用户名通过REMOTE_USER服务器变量我想到了打电话给我的JSF应用程序内通过Apache,并通过用户名的方式(在Apache上运行)。难道这也是一种选择?当然,如果我有选择,我会preFER一个JavaEE的-解决方案...

So now i'm hoping, since most information i found about this topic is at least 1,5 years old, that since then something new has come up to solve my problem. If not, then what would be your suggestions? Since i've written some PHP-Apps (Running on Apache) before where i was able to get the username by the REMOTE_USER server-variable i thought about calling my JSF-App through Apache and passing the username that way. Could that also be an option? Of course, if i had the choice, i would prefer a JavaEE-Solution...

在此先感谢

推荐答案

对于Java EE,让登录的用户:

For Java EE, get the logged in user:

  • 在EL:#{request.remoteUser}
  • 使用JSF API: FacesContext.getCurrentInstance()getExternalContext()getRemoteUser();
  • 从HttpServletRequest的: getUserPrincipal() getRemoteUser()
  • 使用注射: @Inject主要负责人;
  • In EL: #{request.remoteUser}
  • Using JSF API: FacesContext.getCurrentInstance().getExternalContext().getRemoteUser();
  • From HttpServletRequest: getUserPrincipal() and getRemoteUser()
  • Using injection: @Inject Principal principal;

这篇关于检索登录Windows用户(ActiveDir)在JSF2应用(Glassfish的)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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