加载中...
The Wayback Machine - https://sup1a9wrlpyh5li9ro.vcoronado.top/web/20090326194427/http://developer.android.com:80/reference/java/security/Policy.html
public abstract class

Policy

extends Object
java.lang.Object
   ↳ java.security.Policy

Class Overview

Abstract superclass of classes which represent the system security policy.

Summary

Public Constructors
Policy()
Public Methods
abstract PermissionCollection getPermissions(CodeSource cs)
Returns a PermissionCollection describing what permissions are available to the given CodeSource based on the current security policy.
PermissionCollection getPermissions(ProtectionDomain domain)
Returns a PermissionCollection describing what permissions are available to the given ProtectionDomain (more specifically, its CodeSource) based on the current security policy.
static Policy getPolicy()
Returns the current system security policy.
boolean implies(ProtectionDomain domain, Permission permission)
Returns whether the Permission is implied by the PermissionCollection of the Protection Domain
abstract void refresh()
Reloads the policy configuration, depending on how the type of source location for the policy information.
static void setPolicy(Policy policy)
Sets the system-wide policy object if it is permitted by the security manager.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public Policy ()

Public Methods

public abstract PermissionCollection getPermissions (CodeSource cs)

Returns a PermissionCollection describing what permissions are available to the given CodeSource based on the current security policy.

Note that this method is not called for classes which are in the system domain (i.e. system classes). System classes are always given full permissions (i.e. AllPermission). This can not be changed by installing a new Policy.

Parameters
cs CodeSource the code source to compute the permissions for.
Returns
  • PermissionCollection the permissions the code source should have.

public PermissionCollection getPermissions (ProtectionDomain domain)

Returns a PermissionCollection describing what permissions are available to the given ProtectionDomain (more specifically, its CodeSource) based on the current security policy.

Parameters
domain ProtectionDomain the protection domain to compute the permissions for.
Returns
  • PermissionCollection the permissions the code source should have.

public static Policy getPolicy ()

Returns the current system security policy. If no policy has been instantiated then this is done using the security property policy.provider

Returns
  • Policy the current system security policy.

public boolean implies (ProtectionDomain domain, Permission permission)

Returns whether the Permission is implied by the PermissionCollection of the Protection Domain

Parameters
domain ProtectionDomain for which Permission to be checked
permission Permission for which authorization is to be verified
Returns
  • boolean Permission implied by ProtectionDomain

public abstract void refresh ()

Reloads the policy configuration, depending on how the type of source location for the policy information.

public static void setPolicy (Policy policy)

Sets the system-wide policy object if it is permitted by the security manager.

Parameters
policy Policy the policy object that needs to be set.