org.systinet.security.perm
Class WSInvokePermission

java.lang.Object
  extended byjava.security.Permission
      extended byorg.systinet.security.perm.WSInvokePermission
All Implemented Interfaces:
java.security.Guard, java.io.Serializable

public final class WSInvokePermission
extends java.security.Permission

This class represents access permission to WASP Web Service. A WSInvokePermission consists of an optional service name and an optional set of methods, which can be invoked on that service.

Service name is in the same format as the return value of org.idoox.wasp.server.WSContext.getURI().

The actions string of this permission can contain collon-separated method names, but it is not recommended to contain more that one particular method name.

Examples:

 WSInvokePermission "*"
  - allows to invoke all services and all their methods
WSInvokePermission "dummyservice", "getPrice, setPrice" - allows to invoke dummyservice's getPrice and setPrice methods.
WSInvokePermission "dummyservice", "getPrice" - allows to invoke dummyservice's getPrice method.
WSInvokePermission "dummyservice" - allows to invoke all "dummyservice" methods.

Since:
4.0
See Also:
Serialized Form
Component:
Security-Specific

Constructor Summary
WSInvokePermission()
          Creates a new WSInvokePermission object, which allows to invoke all services and all their methods.
WSInvokePermission(java.lang.String serviceName)
          Creates a new WSInvokePermission object with the specified service name.
WSInvokePermission(java.lang.String serviceName, java.lang.String actions)
          Creates a new WSInvokePermission object with the specified service name and methods.
WSInvokePermission(java.lang.String serviceName, java.lang.String[] methods)
          Creates a new WSInvokePermission object with the specified service name and methods.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Checks two WSInvokePermission objects for equality.
 java.lang.String getActions()
          Returns the "canonical string representation" of the actions, i.e.
 java.lang.String[] getMethods()
          Gets the methods which are permitted by this permission.
 int hashCode()
          Returns the hash code value for this object.
 boolean implies(java.security.Permission p)
          Checks if this WSInvokePermission object "implies" the specified permission.
 java.security.PermissionCollection newPermissionCollection()
          Returns a new PermissionCollection object for storing WSInvokePermission objects.
 java.lang.String toString()
          Overriden to return complete description of this permission.
 
Methods inherited from class java.security.Permission
checkGuard, getName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WSInvokePermission

public WSInvokePermission()
Creates a new WSInvokePermission object, which allows to invoke all services and all their methods.


WSInvokePermission

public WSInvokePermission(java.lang.String serviceName)
Creates a new WSInvokePermission object with the specified service name.

Parameters:
serviceName -

WSInvokePermission

public WSInvokePermission(java.lang.String serviceName,
                          java.lang.String[] methods)
Creates a new WSInvokePermission object with the specified service name and methods.

Parameters:
serviceName -
methods - service methods

WSInvokePermission

public WSInvokePermission(java.lang.String serviceName,
                          java.lang.String actions)
Creates a new WSInvokePermission object with the specified service name and methods.

Parameters:
serviceName -
actions - list of methods as a colon separated string
Method Detail

toString

public java.lang.String toString()
Overriden to return complete description of this permission.

Returns:
description of this

getMethods

public java.lang.String[] getMethods()
Gets the methods which are permitted by this permission.

Returns:
null for all methods, sorted string array otherwise

implies

public boolean implies(java.security.Permission p)
Checks if this WSInvokePermission object "implies" the specified permission.

More specifically, this method returns true if:

Parameters:
p - the permission to check against.
Returns:
true if the specified permission is implied by this object, false if not.

equals

public boolean equals(java.lang.Object obj)
Checks two WSInvokePermission objects for equality. Checks that obj is a WSInvokePermission, and has the same servicename and methods as this object.

Parameters:
obj - the object we are testing for equality with this object.
Returns:
true if obj is a WSInvokePermission, and has the same service name and methods as this WSInvokePermission object.

hashCode

public int hashCode()
Returns the hash code value for this object.

Returns:
a hash code value for this object.

getActions

public java.lang.String getActions()
Returns the "canonical string representation" of the actions, i.e. sorter colon-separated list of method or null .

Returns:
the canonical string representation of the methods.

newPermissionCollection

public java.security.PermissionCollection newPermissionCollection()
Returns a new PermissionCollection object for storing WSInvokePermission objects. WSInvokePermission 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.

For example, if you have two WSInvokePermission:

  1. "dummyservice", "getPrice"
  2. "dummyservice", "setPrice"

and you are calling the implies method with the WSInvokePermission:

   "dummyservice", "getPrice,setPrice",
 
then the implies function must take into account both the "getPrice" and "setPrice" permissions, so the effective permission is "getPrice,setPrice", and implies returns true. The "implies" semantics for WSInvokePermission are handled properly by the WSInvokePermissionCollection object returned by this newPermissionCollection method.

Returns:
a new WSInvokePermissionCollection object suitable for storing WSInvokePermissions.