Way to figure out / retrieve Windows username in Oracle APEX

坚强是说给别人听的谎言 提交于 2019-12-23 05:13:14

问题


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.

On the Oracle Database you could do something like

  SELECT SYS_CONTEXT('USERENV', 'OS_USER') "USERNAME"
  FROM dual;

to get it. Is there a similar way for APEX?


回答1:


ActiveX (IE only)

For clients with Internet Explorer then you can identify the windows username through an ActiveX control. There are security requirements to allow the ActiveX to run on the users browser, see this related answer.

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);

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.

This solution would be quite involved however and require access to configure the application server hosting your Apex listener.



来源:https://stackoverflow.com/questions/21522627/way-to-figure-out-retrieve-windows-username-in-oracle-apex

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!