On 7/29/15 8:08 AM, amani wrote:
I am trying to use the Apache derby in java application with security manager
enabled with custom security policies loaded at runtime. In java code
Policy.getPolicy() shows all the policies that I have added in custom policy
file before invoking the derby client.
How can I run derby client in network mode so that the SocketPermissions
required for it can be specified in my custom policy file without having to
add it in the java.policy file?
--
View this message in context:
http://apache-database.10148.n7.nabble.com/How-can-I-run-derby-client-in-network-mode-so-that-the-SocketPermissions-required-for-it-can-be-spece-tp144463.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
I'm not sure I understand the question. A custom policy file can be
specified via the java.security.manager system property as described
here:
http://docs.oracle.com/javase/7/docs/technotes/guides/security/PolicyFiles.html
You can also create a Policy object programmatically, although I have
never tried my hand at this. The header comment for java.security.Policy
says that you can subclass it, creating your own class which declares
the Permissions you want. For instance, you custom Policy subclass could
let you add more Permissions on top of the ones which were installed
when you booted the JVM. Then you would call
java.security.Policy.setPolicy() with your custom Policy subclass as an
argument. This technique is described in greater detail here:
http://stackoverflow.com/questions/11737971/programmatically-grant-permissions-without-using-policy-file
Hope this helps,
-Rick