Database Reference
In-Depth Information
Listing 8-12. Get Proxy Connection from OCI Connection Pool
prop.setProperty(OracleOCIConnectionPool.PROXY_USER_NAME, userName );
conn = (OracleConnection)cpool.getProxyConnection(
OracleOCIConnectionPool.PROXYTYPE_USER_NAME, prop);
For this connection from an OCI pool, we set the client identifier the same way we did previously for
standard connections.
View the Proxy Session
At this point, if you query the OracleConnection.isProxySession() method, you will find that this is not a
proxy session. Don't let that disturb you. If you query Oracle Database you will find that the PROXY_USER
is appusr , and the USER , CURRENT_USER , and SESSION_USER are all set to our OS user identity. This is, by
virtue of acquiring it through the getProxyConnection() method, a proxy connection and a proxy
session.
It is unnecessary, but if you must have the isProxySession() method return true , you can generate
another session through the OracleConnection class—you would have three sessions at that point. Using
this code will also nullify your client identifier, which will interfere with the procedure that sets our
secure application role. So if you do this, modify the SSO procedures (e.g.,
appsec.p_check_hrview_access ) to skip testing the client identifier.
//prop = new Properties();
//prop.setProperty(OracleConnection.PROXY_USER_NAME, userName );
//conn.openProxySession(OracleConnection.PROXYTYPE_USER_NAME, prop);
Note that this code instantiates a new Properties class. The reason for that is that our prior
Properties had numeric keys based on the OracleOCIConnectionPool constants, and this Properties
instance needs String keys based on the OracleConnection constants.
See the Proxy Connection
Here are the results from our test queries in the OraSSOTests.doTest3() method. These results are from
an OCI connection pool proxy connection.
Is proxy session: false
user : OSUSER
userenv proxy_user : APPUSR
userenv current_user : OSUSER
userenv session_user : OSUSER
userenv os_user : ORGDOMAIN\OSUSER
userenv ip_address : 127.0.0.1
userenv terminal : MYCOMPUTER
userenv client_id : OSUSER
Read HR view!!!!!!!!!!!!!!!!!!!!
Notice the first line. As described in the previous section, the OracleConnection.isProxySession()
method returns false ; however, this is a proxy session through a proxy connection. You can see that in
the PROXY_USER identity trait, contrasted with the other user traits.
 
Search WWH ::




Custom Search