jif.lang
Class PrincipalUtil

java.lang.Object
  extended by jif.lang.PrincipalUtil

public class PrincipalUtil
extends java.lang.Object

Utility methods for principals. See the Jif source code, in lib-src/jif/lang/PrincipalUtil.jif


Constructor Summary
PrincipalUtil()
           
 
Method Summary
static boolean acts_for(Principal p, Principal q)
          Returns true if and only if the principal p acts for the principal q.
static boolean actsFor(Principal p, Principal q)
          Returns true if and only if the principal p acts for the principal q.
static Capability authorize(Principal p, java.lang.Object authPrf, Closure c, Label lb)
          Obtain a Capability for the given principal and closure.
static boolean equivalentTo(Principal p, Principal q)
           
static Principal[] findDelegatesChain(Principal p, Principal q)
          Search for a delegates-chain between p and q.
static Principal nullPrincipal()
          returns the null principal, the principal that every other principal can act for.
static boolean verifyChain(Principal[] chain, Principal p, Principal q)
          Verify that the chain is a valid delegates-chain between p and q.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrincipalUtil

public PrincipalUtil()
Method Detail

acts_for

public static boolean acts_for(Principal p,
                               Principal q)
Returns true if and only if the principal p acts for the principal q. A synonym for the actsFor method.


actsFor

public static boolean actsFor(Principal p,
                              Principal q)
Returns true if and only if the principal p acts for the principal q.


findDelegatesChain

public static Principal[] findDelegatesChain(Principal p,
                                             Principal q)
Search for a delegates-chain between p and q. An delegates-chain between p and q is a Principal array a of length L such that
 
  
       a[L-1] == q
       a[L-1] delegates to a[L-2]
       ...
       a[1] delegates to a[0]
       a[0] == p
     
  
 
. Thus, a valid delegate chain between p and q implies that p acts for q.

Parameters:
p -
q -
Returns:
A delegates-chain between p and q, or null if non can be found.

verifyChain

public static boolean verifyChain(Principal[] chain,
                                  Principal p,
                                  Principal q)
Verify that the chain is a valid delegates-chain between p and q. That is, q == chain[n], chain[n] delegates to chain[n-1], ..., chain[0] == p, i.e., p acts for q.


equivalentTo

public static boolean equivalentTo(Principal p,
                                   Principal q)

authorize

public static Capability authorize(Principal p,
                                   java.lang.Object authPrf,
                                   Closure c,
                                   Label lb)
Obtain a Capability for the given principal and closure.


nullPrincipal

public static Principal nullPrincipal()
returns the null principal, the principal that every other principal can act for.