For Programmers: Free Programming Magazines  


Home > Archive > Java Security > March 2006 > extending SecurityManager









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author extending SecurityManager
arbysauce@gmail.com

2006-03-22, 7:06 pm

I'm writing a security manager that I want to grant all permission to
classes loaded by my loader or JRE classes, otherwise no permissions.

My problem is that in checkPermission() , the calls to get class
loaders (of thread / class context) cause checkPermission() calls
themselves and I get an infinite loop.

I see the secmanager methods currentClassLoader() &
currentLoadedClass() that are related to what I'm trying to do, but
they are deprecated and it is recommended to use checkPermission to
somehow acclomplish the same type of check.

I must be missing something here -- any ideas on how to override
checkPermission() and use methods in there that trigger calls to
checkPermission themselves? And/or a better strategy to accomplish
my main goal?

TIA John

Thomas Hawtin

2006-03-22, 10:02 pm

arbysauce@gmail.com wrote:
> I'm writing a security manager that I want to grant all permission to
> classes loaded by my loader or JRE classes, otherwise no permissions.
>
> My problem is that in checkPermission() , the calls to get class
> loaders (of thread / class context) cause checkPermission() calls
> themselves and I get an infinite loop.


Not really my area, but: I think you want to be looking at
java.security.SecureClassLoader. Particularly getPermissions. Also
java.net.URLClassLoader. Add permissions to classes (indirectly) and let
AccessController do its stuff.

Extending SecurityManager is usually about restricting permissions (see
sun.applet.AppletSecurity).

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com