APIdia Launch Partner
Top Description Fields Constructors Methods
java.security

public final Class AccessController

extends Object
Class Inheritance
Annotations
@Deprecated
since:17
forRemoval:true

Deprecated

for removal since 17.

This class was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for the Security Manager or this class.

AccessController was used with the Security Manager for access control operations and decisions. This feature no longer exists.
Authors
Li Gong, Roland Schemers
Since
1.2

Field Summary

Modifier and TypeField and Description
private static AccessControlContext
NO_PERMISSIONS_ACC

References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Constructor Summary

AccessConstructor and Description
private
AccessController()

Don't allow anyone to instantiate an AccessController

Method Summary

Modifier and TypeMethod and Description
public static void
checkPermission(Permission
ignored
perm
)

Throws AccessControlException.

public static <
the type of the value returned by the PrivilegedAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivileged
(PrivilegedAction<T>
the action to be performed
action
)

Performs the specified action.

public static <
the type of the value returned by the PrivilegedAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivileged
(PrivilegedAction<T>
the action to be performed.
action
,
AccessControlContext
ignored
context
)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Performs the specified action.

public static <
the type of the value returned by the PrivilegedAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivileged
(PrivilegedAction<T>
the action to be performed
action
,
AccessControlContext
ignored
context
,
Permission...
ignored
perms
)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Performs the specified action.

public static <
the type of the value returned by the PrivilegedExceptionAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivileged
(PrivilegedExceptionAction<T>
the action to be performed
action
)

Performs the specified action.

public static <
the type of the value returned by the PrivilegedExceptionAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivileged
(PrivilegedExceptionAction<T>
the action to be performed
action
,
AccessControlContext
ignored
context
)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Performs the specified action.

public static <
the type of the value returned by the PrivilegedExceptionAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivileged
(PrivilegedExceptionAction<T>
the action to be performed
action
,
AccessControlContext
ignored
context
,
Permission...
ignored
perms
)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Performs the specified action.

public static <
the type of the value returned by the PrivilegedAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivilegedWithCombiner
(PrivilegedAction<T>
the action to be performed
action
)

Performs the specified action.

public static <
the type of the value returned by the PrivilegedAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivilegedWithCombiner
(PrivilegedAction<T>
the action to be performed
action
,
AccessControlContext
ignored
context
,
Permission...
ignored
perms
)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Performs the specified action.

public static <
the type of the value returned by the PrivilegedExceptionAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivilegedWithCombiner
(PrivilegedExceptionAction<T>
the action to be performed
action
)

Performs the specified action.

public static <
the type of the value returned by the PrivilegedExceptionAction's run method
T
>
T

Returns:

the value returned by the action's run method
doPrivilegedWithCombiner
(PrivilegedExceptionAction<T>
the action to be performed
action
,
AccessControlContext
ignored
context
,
Permission...
ignored
perms
)
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

Performs the specified action.

public static AccessControlContext

Returns:

an AccessControlContext as specified above
getContext
()
References Deprecated AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

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

private static PrivilegedActionException
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

NO_PERMISSIONS_ACCback to summary
private static AccessControlContext NO_PERMISSIONS_ACC

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Annotations
@SuppressWarnings:removal

Constructor Detail

AccessControllerback to summary
private AccessController()

Don't allow anyone to instantiate an AccessController

Method Detail

checkPermissionback to summary
public static void checkPermission(Permission perm) throws AccessControlException

Throws AccessControlException.

API Note

This method originally determined whether the access request indicated by the specified permission should be allowed or denied, based on the current AccessControlContext and security policy. This method has been changed to always throw AccessControlException. This method was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for the Security Manager or this method.

Parameters
perm:Permission

ignored

Annotations
@SuppressWarnings:removal
Exceptions
AccessControlException:
always
doPrivilegedback to summary
public static <T> T doPrivileged(PrivilegedAction<T> action)

Performs the specified action.

If the action's run method throws an (unchecked) exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedAction with privileges enabled. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedAction's run method
action:PrivilegedAction<T>

the action to be performed

Returns:T

the value returned by the action's run method

Exceptions
NullPointerException:
if the action is null
See Also
doPrivileged(PrivilegedAction, AccessControlContext), doPrivileged(PrivilegedExceptionAction)
doPrivilegedback to summary
public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context)

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Performs the specified action.

If the action's run method throws an (unchecked) exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedAction with privileges enabled and restricted by the specified AccessControlContext. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedAction's run method
action:PrivilegedAction<T>

the action to be performed.

context:AccessControlContext

ignored

Returns:T

the value returned by the action's run method

Exceptions
NullPointerException:
if the action is null
doPrivilegedback to summary
public static <T> T doPrivileged(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Performs the specified action.

If the action's run method throws an (unchecked) exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedAction's run method
action:PrivilegedAction<T>

the action to be performed

context:AccessControlContext

ignored

perms:Permission[]

ignored

Returns:T

the value returned by the action's run method

Exceptions
NullPointerException:
if action is null
Since
1.8
doPrivilegedback to summary
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action) throws PrivilegedActionException

Performs the specified action.

If the action's run method throws an unchecked exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedExceptionAction with privileges enabled. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedExceptionAction's run method
action:PrivilegedExceptionAction<T>

the action to be performed

Returns:T

the value returned by the action's run method

Exceptions
PrivilegedActionException:
if the specified action's run method threw a checked exception
NullPointerException:
if the action is null
doPrivilegedback to summary
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context) throws PrivilegedActionException

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Performs the specified action.

If the action's run method throws an unchecked exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedExceptionAction with privileges enabled and restricted by the specified AccessControlContext. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedExceptionAction's run method
action:PrivilegedExceptionAction<T>

the action to be performed

context:AccessControlContext

ignored

Returns:T

the value returned by the action's run method

Exceptions
PrivilegedActionException:
if the specified action's run method threw a checked exception
NullPointerException:
if the action is null
See Also
doPrivileged(PrivilegedAction), doPrivileged(PrivilegedAction, AccessControlContext)
doPrivilegedback to summary
public static <T> T doPrivileged(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Performs the specified action.

If the action's run method throws an (unchecked) exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedExceptionAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedExceptionAction's run method
action:PrivilegedExceptionAction<T>

the action to be performed

context:AccessControlContext

ignored

perms:Permission[]

ignored

Returns:T

the value returned by the action's run method

Exceptions
PrivilegedActionException:
if the specified action's run method threw a checked exception
NullPointerException:
if action is null
Since
1.8
doPrivilegedWithCombinerback to summary
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action)

Performs the specified action.

If the action's run method throws an (unchecked) exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedAction with privileges enabled and with the current access control context's domain combiner preserved. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedAction's run method
action:PrivilegedAction<T>

the action to be performed

Returns:T

the value returned by the action's run method

Exceptions
NullPointerException:
if the action is null
Since
1.6
doPrivilegedWithCombinerback to summary
public static <T> T doPrivilegedWithCombiner(PrivilegedAction<T> action, AccessControlContext context, Permission... perms)

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Performs the specified action.

If the action's run method throws an (unchecked) exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. This method also originally preserved the current access control context's domain combiner while the action was performed. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedAction's run method
action:PrivilegedAction<T>

the action to be performed

context:AccessControlContext

ignored

perms:Permission[]

ignored

Returns:T

the value returned by the action's run method

Exceptions
NullPointerException:
if action is null
Since
1.8
doPrivilegedWithCombinerback to summary
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action) throws PrivilegedActionException

Performs the specified action.

If the action's run method throws an unchecked exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedExceptionAction with privileges enabled and with the current access control context's domain combiner preserved. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedExceptionAction's run method
action:PrivilegedExceptionAction<T>

the action to be performed

Returns:T

the value returned by the action's run method

Exceptions
PrivilegedActionException:
if the specified action's run method threw a checked exception
NullPointerException:
if the action is null
Since
1.6
doPrivilegedWithCombinerback to summary
public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action, AccessControlContext context, Permission... perms) throws PrivilegedActionException

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Performs the specified action.

If the action's run method throws an (unchecked) exception, it will propagate through this method.

API Note

This method originally performed the specified PrivilegedExceptionAction with privileges enabled and restricted by the specified AccessControlContext and with a privilege scope limited by the specified Permission arguments. This method also preserved the current access control context's domain combiner while the action was performed. Running the action with privileges enabled was only useful in conjunction with the Security Manager, which is no longer supported. This method has been changed to run the action as is, and has equivalent behavior as if there were no Security Manager enabled. There is no replacement for the Security Manager or this method.

Parameters
<T>
the type of the value returned by the PrivilegedExceptionAction's run method
action:PrivilegedExceptionAction<T>

the action to be performed

context:AccessControlContext

ignored

perms:Permission[]

ignored

Returns:T

the value returned by the action's run method

Exceptions
PrivilegedActionException:
if the specified action's run method threw a checked exception
NullPointerException:
if action is null
Since
1.8
getContextback to summary
public static AccessControlContext getContext()

References Deprecated

AccessControlContext is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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. This method was only useful in conjunction with the Security Manager, which is no longer supported. There is no replacement for the Security Manager or this method.

Returns:AccessControlContext

an AccessControlContext as specified above

Annotations
@SuppressWarnings:removal
See Also
AccessControlContext
wrapExceptionback to summary
private static PrivilegedActionException wrapException(Exception e)