Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |
java.lang.Object | +----java.security.Permission | +----java.net.SocketPermission
host = (hostname | IPaddress)[:portrange] portrange = portnumber | portnumber-[portnumber]The possible ways to connect to the host are
accept connect listen resolveThe "listen" action is only meaningful when used with "localhost". The "resolve" (resolve host/ip name service lookups) action is implied when any of the other actions are present.
As an example of the creation and meaning of SocketPermissions, if the following permissions are created for classes signed by mrm:
p1 = new SocketPermission("puffin.eng.sun.com:7777", "connect,accept"); p2 = new SocketPermission("localhost:1024-", "accept,connect,listen");then classes signedBy mrm can connect to port 7777 on
puffin.eng.sun.com
, or accept connections on that port.
Classes signedBy mrm may also listen on any port between 1024 and
65535, as well as port 0.
Constructor Summary | |
SocketPermission(String host,
String action)
|
Method Summary | |
boolean | equals(Object obj)
|
String | getActions()
|
int | hashCode()
|
boolean | implies(Permission p)
|
PermissionCollection | newPermissionCollection()
|
Methods inherited from class java.security.Permission |
checkGuard, equals, getActions, getName, hashCode, implies, newPermissionCollection, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public SocketPermission(String host, String action)
The actions parameter contains a comma-separated list of the actions granted for the specified host (and port(s)). Possible actions are "connect", "listen", "accept", "resolve", or any combination of those. "resolve" is automatically added when any of the other three are specified.
Examples of SocketPermission instantiation are the following:
nr = new SocketPermission("www.catalog.com", "connect"); nr = new SocketPermission("www.sun.com:80", "connect"); nr = new SocketPermission("*.sun.com", "connect"); nr = new SocketPermission("*.edu", "resolve"); nr = new SocketPermission("204.160.241.0", "connect"); nr = new SocketPermission("localhost:1024-65535", "listen"); nr = new SocketPermission("204.160.241.0:1024-65535", "connect");
host
- the hostname or IPaddress of the computer, optionally
including a colon followed by a port or port range.
action
- the action string.
Method Detail |
public boolean implies(Permission p)
More specifically, this method first ensures that all of the following are true (and returns false if any of them are not):
implies
checks each of the following, in order,
and for each returns true if the stated condition is true:
implies
returns false.
p
- the permission to check against.
public boolean equals(Object obj)
obj
- the object to test for equality with this object.
public int hashCode()
public String getActions()
public PermissionCollection newPermissionCollection()
SocketPermission objects must be stored in a manner that allows them
to be inserted into the collection in any order, but that also enables the
PermissionCollection implies
method to be implemented in an efficient (and consistent) manner.
Contents | Package | Class | Tree | Deprecated | Index | Help | Java 1.2 Beta 3 | ||
PREV | NEXT | SHOW LISTS | HIDE LISTS |