Indirect access to protection domain

Hi,

I have a few classes that are in a protection domain, say A, with the necessary permissions to create (jdbc-odbc) database connections. Now I want classes that are not member another protection domain B (so classes outside of the protection domain A) to only be able to get database connections through classes of the protection domain A. Classes in protection domain B are granted access to protection domain A, but not to package sun.jdbc.odbc. So these classes cannot create a database connection directly but have to do this through the classes in protection domain A.

The problem now is that, as far as my knowledge goes, all classes in the call-chain have to be priviledged to have acces to the package sun.jdbc.odbc in order to create a connection. So I have to grant protection domain B access to the package sun.jdbc.odbc. But then classes from B can also create connections directly and that is not what I want.

Could someone help me out here?

Thank you,

Ron

[1017 byte] By [Corpse] at [2007-9-26 8:35:35]
# 1

Put your JDBC code in PD A in

AccessController.doPriviledged(new PriviledgedAction {

public Object run() {

// your JDBC code here

}

});

In this way B can access JDBC through A without

priviledge to access JDBC directly.

See the javadoc of AccessController.

syzhong at 2007-7-1 19:19:15 > top of Java-index,Security,Other Security APIs, Tools, and Issues...
# 2
Thank you for you response. I already spotted the AccessController. Unfortunately this will not work for the real case in which I want to use this. In my real case PD B is a third party library which I cannot alter.Any other suggestions?Regards,Ron
Corpse at 2007-7-1 19:19:15 > top of Java-index,Security,Other Security APIs, Tools, and Issues...