The stored procedures are doing auditing plus I'd like to have the
Oracle VPD features work and this requires we set 'USER' inside Oracle
(select USER from dual;) I've started by setting the
client_identifier in the session, as described at:
http://download.oracle.com/docs/cd/B13789_01/network.101/b10773/apdvprxy.htm#1010357.
See code below which I've put as a before filter on my
application_controller.rb
def set_oracle_session_identifier
plsql.activerecord_class = ActiveRecord::Base
plsql.dbms_session.set_identifier(current_user.login)
end
The stored procedures would then do the following to either select the
client_identifier if it was specified or the 'USER'.
select decode(sys_context
('userenv','client_identifier'),NULL,USER,sys_context
('userenv','client_identifier')) FROM DUAL
This works but doesn't seem very secure so I'd like to use proxy
authentication, as described at:
http://download.oracle.com/docs/cd/B13789_01/network.101/b10773/apdvprxy.htm#1010289.
How would I make the openProxySession call to switch my connection to
the logged on user if using the Oracle Enhanced Adapter? Could I
simply put this openProxySession call as a before filter on
application_controller or are there complexities to using proxy
authentication combined with Rails and the enhanced adapter?