org.kaariboga.core
Class KaaribogaSecurityManager

java.lang.Object
  |
  +--java.lang.SecurityManager
        |
        +--org.kaariboga.core.KaaribogaSecurityManager

public final class KaaribogaSecurityManager
extends java.lang.SecurityManager

Simple Security Manager to prevent agents doing some bad things. Prevents agents to execute commands or delete files.


Field Summary
private  boolean secure
           
 
Fields inherited from class java.lang.SecurityManager
accessClipboardPermission, allPermission, checkAwtEventQueuePermission, checkMemberAccessPermission, createClassLoaderPermission, inCheck, initialized, localListenPermission, packageAccess, packageAccessValid, packageDefinition, packageDefinitionValid, rootGroup, threadGroupPermission, threadPermission, topLevelWindowPermission
 
Constructor Summary
KaaribogaSecurityManager(boolean secure)
          Creates a new security manager.
 
Method Summary
 void checkAccept(java.lang.String host, int port)
          Checks if a class may accept connections on an incoming socket.
 void checkAccess(java.lang.Thread thread)
          At the moment this is always allowed!
 void checkAccess(java.lang.ThreadGroup threadGroup)
          At the moment this is always allowed!
 void checkAwtEventQueueAccess()
          Always allowed!
 void checkConnect(java.lang.String host, int port)
          Checks if a class may connect to a specified host.
 void checkCreateClassLoader()
          Checks if a class may create it's own class loader.
 void checkDelete(java.lang.String filename)
          Checks if a class may delete files.
 void checkExec(java.lang.String command)
          Checks if a class may execute a system command.
 void checkExit(int status)
          Checks if a class is allowed to end the virtual machine.
 void checkLink(java.lang.String lib)
          Always allowed!
 void checkListen(int port)
          Checks if a class may listen on a specified port.
 void checkPackageAccess(java.lang.String pkg)
          Always allowed!
 void checkPackageDefinition(java.lang.String pkg)
          Always allowed!
 void checkPropertiesAccess()
          Checks if access to system properties is allowed.
 void checkPropertyAccess(java.lang.String key)
          Checks if access to system properties is allowed.
 void checkPropertyAccess(java.lang.String key, java.lang.String def)
          Checks if access to system properties is allowed.
 void checkRead(java.io.FileDescriptor fd)
          Checks if a class may read files through a file descriptor.
 void checkRead(java.lang.String filename)
          Checks if a class may read files.
 void checkSecurityAccess(java.lang.String action)
          Always allowed!
 void checkSetFactory()
          Always allowed!
 boolean checkTopLevelWindow(java.lang.Object window)
          Alway returns true.
 void checkWrite(java.io.FileDescriptor fd)
          Checks if a class may write files with a give file descriptor.
 void checkWrite(java.lang.String filename)
          Checks if writing files is allowed.
 
Methods inherited from class java.lang.SecurityManager
, checkConnect, checkMemberAccess, checkMulticast, checkMulticast, checkPermission, checkPermission, checkPrintJobAccess, checkRead, checkSystemClipboardAccess, classDepth, classLoaderDepth, classLoaderDepth0, currentClassLoader, currentClassLoader0, currentLoadedClass, currentLoadedClass0, getClassContext, getInCheck, getPackages, getRootGroup, getSecurityContext, getThreadGroup, hasAllPermission, inClass, inClassLoader
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

secure

private boolean secure
Constructor Detail

KaaribogaSecurityManager

public KaaribogaSecurityManager(boolean secure)
Creates a new security manager.
Parameters:
secure - If secure = true the security checks are activated.
Method Detail

checkAccept

public void checkAccept(java.lang.String host,
                        int port)
Checks if a class may accept connections on an incoming socket. At the moment this is always allowed!
Overrides:
checkAccept in class java.lang.SecurityManager

checkConnect

public void checkConnect(java.lang.String host,
                         int port)
Checks if a class may connect to a specified host. At the moment this is always allowed!
Overrides:
checkConnect in class java.lang.SecurityManager

checkListen

public void checkListen(int port)
Checks if a class may listen on a specified port. At the moment this is always allowed!
Overrides:
checkListen in class java.lang.SecurityManager

checkAccess

public void checkAccess(java.lang.Thread thread)
At the moment this is always allowed!
Overrides:
checkAccess in class java.lang.SecurityManager

checkAccess

public void checkAccess(java.lang.ThreadGroup threadGroup)
At the moment this is always allowed!
Overrides:
checkAccess in class java.lang.SecurityManager

checkCreateClassLoader

public void checkCreateClassLoader()
Checks if a class may create it's own class loader. At the moment this is always allowed!
Overrides:
checkCreateClassLoader in class java.lang.SecurityManager

checkDelete

public void checkDelete(java.lang.String filename)
Checks if a class may delete files. Only allowed if security = false !
Overrides:
checkDelete in class java.lang.SecurityManager

checkRead

public void checkRead(java.lang.String filename)
Checks if a class may read files. Always allowed!
Overrides:
checkRead in class java.lang.SecurityManager

checkWrite

public void checkWrite(java.lang.String filename)
Checks if writing files is allowed. Only allowed if security = false !
Overrides:
checkWrite in class java.lang.SecurityManager

checkWrite

public void checkWrite(java.io.FileDescriptor fd)
Checks if a class may write files with a give file descriptor. Always allowed, needed for writing to streams.
Overrides:
checkWrite in class java.lang.SecurityManager

checkRead

public void checkRead(java.io.FileDescriptor fd)
Checks if a class may read files through a file descriptor. Always allowed.
Overrides:
checkRead in class java.lang.SecurityManager

checkExec

public void checkExec(java.lang.String command)
Checks if a class may execute a system command. Only allowed if security = false !
Overrides:
checkExec in class java.lang.SecurityManager

checkExit

public void checkExit(int status)
Checks if a class is allowed to end the virtual machine. At the moment always allowed, because it is better for test purposes.
Overrides:
checkExit in class java.lang.SecurityManager

checkPropertiesAccess

public void checkPropertiesAccess()
Checks if access to system properties is allowed. Alway allowed !
Overrides:
checkPropertiesAccess in class java.lang.SecurityManager

checkPropertyAccess

public void checkPropertyAccess(java.lang.String key)
Checks if access to system properties is allowed. Alway allowed !
Overrides:
checkPropertyAccess in class java.lang.SecurityManager

checkPropertyAccess

public void checkPropertyAccess(java.lang.String key,
                                java.lang.String def)
Checks if access to system properties is allowed. Alway allowed !

checkTopLevelWindow

public boolean checkTopLevelWindow(java.lang.Object window)
Alway returns true.
Overrides:
checkTopLevelWindow in class java.lang.SecurityManager

checkAwtEventQueueAccess

public void checkAwtEventQueueAccess()
Always allowed!
Overrides:
checkAwtEventQueueAccess in class java.lang.SecurityManager

checkLink

public void checkLink(java.lang.String lib)
Always allowed!
Overrides:
checkLink in class java.lang.SecurityManager

checkPackageAccess

public void checkPackageAccess(java.lang.String pkg)
Always allowed!
Overrides:
checkPackageAccess in class java.lang.SecurityManager

checkPackageDefinition

public void checkPackageDefinition(java.lang.String pkg)
Always allowed!
Overrides:
checkPackageDefinition in class java.lang.SecurityManager

checkSecurityAccess

public void checkSecurityAccess(java.lang.String action)
Always allowed!
Overrides:
checkSecurityAccess in class java.lang.SecurityManager

checkSetFactory

public void checkSetFactory()
Always allowed!
Overrides:
checkSetFactory in class java.lang.SecurityManager