APIdia Launch Partner
Top Description Inners Constructors Methods
java.lang

public Class SecurityManager

extends Object
Class Inheritance
Annotations
@Deprecated
since:17
forRemoval:true
Imports
java.io.FileDescriptor, java.net.InetAddress, java.security.AccessController, .Permission, java.util.Set

Deprecated

for removal since 17.

There is no replacement for this class.

SecurityManager was originally specified to allow an application implement a security policy. It allowed an application to determine, before performing a possibly unsafe or security sensitive operation, whether the operation was being attempted in a security context that allowed the operation. This feature no longer exists.
Since
1.0

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Constructor Summary

AccessConstructor and Description
public
SecurityManager()

Constructs a new SecurityManager.

Method Summary

Modifier and TypeMethod and Description
public void
checkAccept(String
ignored
host
,
int
ignored
port
)

Throws SecurityException.

public void
checkAccess(Thread
ignored
t
)

Throws SecurityException.

public void
checkAccess(ThreadGroup
ignored
g
)

Throws SecurityException.

public void
checkConnect(String
ignored
host
,
int
ignored
port
)

Throws SecurityException.

public void
checkConnect(String
ignored
host
,
int
ignored
port
,
Object
ignored
context
)

Throws SecurityException.

public void
checkCreateClassLoader()

Throws SecurityException.

public void
checkDelete(String
ignored
file
)

Throws SecurityException.

public void
checkExec(String
ignored
cmd
)

Throws SecurityException.

public void
checkExit(int
ignored
status
)

Throws SecurityException.

public void
checkListen(int
ignored
port
)

Throws SecurityException.

public void
checkMulticast(InetAddress
ignored
maddr
)

Throws SecurityException.

public void
checkMulticast(InetAddress
ignored
maddr
,
byte
ignored
ttl
)

Throws SecurityException.

public void
checkPackageAccess(String
ignored
pkg
)

Throws SecurityException.

public void
checkPackageDefinition(String
ignored
pkg
)

Throws SecurityException.

public void
checkPermission(Permission
ignored
perm
)

Throws SecurityException.

public void
checkPermission(Permission
ignored
perm
,
Object
ignored
context
)

Throws SecurityException.

public void
checkPrintJobAccess()

Throws SecurityException.

public void
checkPropertiesAccess()

Throws SecurityException.

public void
checkPropertyAccess(String
ignored
key
)

Throws SecurityException.

public void
checkRead(FileDescriptor
the system-dependent file descriptor
fd
)

Throws SecurityException.

public void
checkRead(String
ignored
file
)

Throws SecurityException.

public void
checkRead(String
ignored
file
,
Object
ignored
context
)

Throws SecurityException.

public void
checkSecurityAccess(String
ignored
target
)

Throws SecurityException.

public void
checkSetFactory()

Throws SecurityException.

public void
checkWrite(FileDescriptor
ignored
fd
)

Throws SecurityException.

public void
checkWrite(String
ignored
file
)

Throws SecurityException.

protected Class<?>[]

Returns:

the execution stack.
getClassContext
()

Returns the current execution stack as an array of classes.

public Object

Returns:

an AccessControlContext as specified above
getSecurityContext
()

Returns an AccessControlContext where the checkPermission method always throws an AccessControlException and the getDomainCombiner method always returns null.

public ThreadGroup

Returns:

the current Thread's ThreadGroup
getThreadGroup
()

Returns the current Thread's ThreadGroup.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

SecurityManagerback to summary
public SecurityManager()

Constructs a new SecurityManager. Setting a security manager with System#setSecurityManager(SecurityManager) is not supported.

Method Detail

checkAcceptback to summary
public void checkAccept(String host, int port)

Throws SecurityException.

Parameters
host:String

ignored

port:int

ignored

Exceptions
SecurityException:
always
checkAccessback to summary
public void checkAccess(Thread t)

Throws SecurityException.

Parameters
t:Thread

ignored

Exceptions
SecurityException:
always
checkAccessback to summary
public void checkAccess(ThreadGroup g)

Throws SecurityException.

Parameters
g:ThreadGroup

ignored

Exceptions
SecurityException:
always
checkConnectback to summary
public void checkConnect(String host, int port)

Throws SecurityException.

Parameters
host:String

ignored

port:int

ignored

Exceptions
SecurityException:
always
checkConnectback to summary
public void checkConnect(String host, int port, Object context)

Throws SecurityException.

Parameters
host:String

ignored

port:int

ignored

context:Object

ignored

Exceptions
SecurityException:
always
checkCreateClassLoaderback to summary
public void checkCreateClassLoader()

Throws SecurityException.

Exceptions
SecurityException:
always
checkDeleteback to summary
public void checkDelete(String file)

Throws SecurityException.

Parameters
file:String

ignored

Exceptions
SecurityException:
always
checkExecback to summary
public void checkExec(String cmd)

Throws SecurityException.

Parameters
cmd:String

ignored

Exceptions
SecurityException:
always
checkExitback to summary
public void checkExit(int status)

Throws SecurityException.

Parameters
status:int

ignored

Exceptions
SecurityException:
always
checkListenback to summary
public void checkListen(int port)

Throws SecurityException.

Parameters
port:int

ignored

Exceptions
SecurityException:
always
checkMulticastback to summary
public void checkMulticast(InetAddress maddr)

Throws SecurityException.

Parameters
maddr:InetAddress

ignored

Exceptions
SecurityException:
always
Since
1.1
checkMulticastback to summary
public void checkMulticast(InetAddress maddr, byte ttl)

Throws SecurityException.

Parameters
maddr:InetAddress

ignored

ttl:byte

ignored

Exceptions
SecurityException:
always
Since
1.1
checkPackageAccessback to summary
public void checkPackageAccess(String pkg)

Throws SecurityException.

Parameters
pkg:String

ignored

Exceptions
SecurityException:
always
checkPackageDefinitionback to summary
public void checkPackageDefinition(String pkg)

Throws SecurityException.

Parameters
pkg:String

ignored

Exceptions
SecurityException:
always
checkPermissionback to summary
public void checkPermission(Permission perm)

Throws SecurityException.

Parameters
perm:Permission

ignored

Exceptions
SecurityException:
always
Since
1.2
checkPermissionback to summary
public void checkPermission(Permission perm, Object context)

Throws SecurityException.

Parameters
perm:Permission

ignored

context:Object

ignored

Exceptions
SecurityException:
always
Since
1.2
checkPrintJobAccessback to summary
public void checkPrintJobAccess()

Throws SecurityException.

Exceptions
SecurityException:
always
Since
1.1
checkPropertiesAccessback to summary
public void checkPropertiesAccess()

Throws SecurityException.

Exceptions
SecurityException:
always
checkPropertyAccessback to summary
public void checkPropertyAccess(String key)

Throws SecurityException.

Parameters
key:String

ignored

Exceptions
SecurityException:
always
checkReadback to summary
public void checkRead(FileDescriptor fd)

Throws SecurityException.

Parameters
fd:FileDescriptor

the system-dependent file descriptor

Exceptions
SecurityException:
always
checkReadback to summary
public void checkRead(String file)

Throws SecurityException.

Parameters
file:String

ignored

Exceptions
SecurityException:
always
checkReadback to summary
public void checkRead(String file, Object context)

Throws SecurityException.

Parameters
file:String

ignored

context:Object

ignored

Exceptions
SecurityException:
always
checkSecurityAccessback to summary
public void checkSecurityAccess(String target)

Throws SecurityException.

Parameters
target:String

ignored

Exceptions
SecurityException:
always
Since
1.1
checkSetFactoryback to summary
public void checkSetFactory()

Throws SecurityException.

Exceptions
SecurityException:
always
checkWriteback to summary
public void checkWrite(FileDescriptor fd)

Throws SecurityException.

Parameters
fd:FileDescriptor

ignored

Exceptions
SecurityException:
always
checkWriteback to summary
public void checkWrite(String file)

Throws SecurityException.

Parameters
file:String

ignored

Exceptions
SecurityException:
always
getClassContextback to summary
protected Class<?>[] getClassContext()

Returns the current execution stack as an array of classes.

The length of the array is the number of methods on the execution stack. The element at index 0 is the class of the currently executing method, the element at index 1 is the class of that method's caller, and so on.

API Note

The StackWalker class can be used as a replacement for this method.

Returns:Class<?>[]

the execution stack.

getSecurityContextback to summary
public Object getSecurityContext()

Returns an AccessControlContext where the checkPermission method always throws an AccessControlException and the getDomainCombiner method always returns null.

API Note

This method originally returned a snapshot of the current calling context, which included the current thread's access control context and any limited privilege scope. This method has been changed to always return an innocuous AccessControlContext that fails all permission checks. The Security Manager is no longer supported. There is no replacement for the Security Manager or this method.

Returns:Object

an AccessControlContext as specified above

Annotations
@SuppressWarnings:removal
See Also
AccessControlContext
getThreadGroupback to summary
public ThreadGroup getThreadGroup()

Returns the current Thread's ThreadGroup.

Returns:ThreadGroup

the current Thread's ThreadGroup

Since
1.1
java.lang back to summary

private Class SecurityManager.StackWalkerHolder

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv static final StackWalker

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

STACK_WALKERback to summary
pack-priv static final StackWalker STACK_WALKER

Constructor Detail

StackWalkerHolderback to summary
private StackWalkerHolder()