Re: Obtain information about client from within an APEX application
Date: Thu, 10 May 2012 15:21:59 -0400
This just worked for me to get IP address of my workstation that was hitting my Apex server... I believe this may be obscured if you have any proxy or forwarding going on (you may get the IP address of the appliance doing the proxy):
htp.p('User IP Address: ' || OWA_UTIL.get_cgi_env ('REMOTE_ADDR'));
I'm not sure if getting username will be that simple. You can get APP_USER substitution variable if the user is authenticated in some way... This is not necessarily OSUSER on their workstation if that is what you are looking for. We get around this by creating a 'Single Sign On' custom auth layer... so APP_USER gets authenticated via our site SSO scheme, then from there on out APP_USER is set correctly. If they don't authenticate nicely then they get hand in face.
More info about the substitution string here: http://www.utoug.org/i/doc/concept_sub_strings.htm#BEIHCJBG
htp.p( V('APP_USER') );