找出/检索Oracle APEX中的Windows用户名的方法 [英] Way to figure out / retrieve Windows username in Oracle APEX
问题描述
我想知道,是否有一种方法可以通过某种功能来获取Windows用户名,...在Oracle APEX 4.2中将其填充到应用程序页面中的Display Only
元素.我不想进行登录身份验证,我只想获取用户名.
I wanted to know, if there is a way to just get the Windows username with some kind of function, ... in Oracle APEX 4.2 an populate it a Display Only
element in an application page. I don't want to do a login authentification, I just want to get the username.
在Oracle数据库上,您可以执行类似的操作
On the Oracle Database you could do something like
SELECT SYS_CONTEXT('USERENV', 'OS_USER') "USERNAME"
FROM dual;
得到它. APEX有类似的方法吗?
to get it. Is there a similar way for APEX?
推荐答案
ActiveX(仅适用于IE)
对于具有Internet Explorer的客户端,则可以通过ActiveX控件标识Windows用户名.有一些安全要求,允许ActiveX在用户浏览器上运行,请参阅此相关答案.
要在Apex中实现此功能,您需要创建一个动态操作来运行ActiveX&页面加载中的javascript可以检索用户名并使用JS API设置页面项的值
To implement this in Apex you would create a dynamic action that runs the ActiveX & javascript on page load to retrieve the username and the set a page item value using the JS API
var net = new ActiveXObject ( "WScript.NetWork" );
var username = net.UserName;
$s('P123_HIDDEN_USERNAME',username);
从Web服务器
您可以按照此文章中的描述在应用服务器级别检索操作系统用户名. Oracle论坛-使用weblogic或mod_ntlm/mod_auth_kerberos.即使不用于身份验证,也可能在会话开始时将用户名检索到应用程序级项中.
From the Web Server
You may be able to retrieve the OS username at the application server level as described in this post on the Oracle Forums - using either weblogic or mod_ntlm/mod_auth_kerberos. Even if not using for authentication it maybe possible to retrieve the username into an application level item at the start of a session.
但是,此解决方案会涉及很多,并且需要访问权限才能配置托管您的Apex侦听器的应用服务器.
This solution would be quite involved however and require access to configure the application server hosting your Apex listener.
这篇关于找出/检索Oracle APEX中的Windows用户名的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!