Bees v0.5.0 API

bees.core
Class AuthorizationCoroutine

java.lang.Object
  |
  +--bees.core.Coroutine
        |
        +--bees.core.ResponderCoroutine
              |
              +--bees.core.AuthorizationCoroutine

public class AuthorizationCoroutine
extends ResponderCoroutine

A Coroutine for interacting with the Auth App. This coroutine can be used by a downloaded protocol to dynamically request capabilities from the Auth App. It can also be used to inform the Auth App that the protocol wishes to be "managed." A protocol becomes "managed" when its ProtocolSession or ExtendedProtocolSession is connected to a ProtocolPresentation in the Auth App. Thus, in the case of the extended version, the protocol will be notified of newly discovered or lost neighbors.


Field Summary
static int STATE_CONNECTED
          Indicates the coroutine is connected to a peer.
static int STATE_REQUESTING
          Indicates the requesting Coroutine is waiting for a response.
 
Fields inherited from class bees.core.Coroutine
DEFAULT_TIMEOUT, INVALID_ID, STATE_ANY, STATE_COMPLETE, STATE_ERROR, STATE_ERROR_CAGED, STATE_ERROR_INTERNAL, STATE_ERROR_TIMEOUT, STATE_ERROR_USER, STATE_NEWBORN, STATE_USER
 
Constructor Summary
AuthorizationCoroutine()
          Construct an empty AuthorizationCoroutine.
AuthorizationCoroutine(AuthorizationCoroutine ac)
          Construct an AuthorizationCoroutine with the given argument.
AuthorizationCoroutine(StateResponder sr, AuthorizationCoroutine ac)
          Construct an AuthorizationCoroutine with the given arguments.
 
Method Summary
protected  CapabilityEnvelope[] authorize(CapabilityEnvelope requester, java.lang.String src, java.lang.String dst, byte[] auth)
          Call back used to handle an authorize event.
protected  void beginExtendedManagement(CapabilityEnvelope ce, TypeID sessionID)
          Call back used to handle a beginExtendedManagement event.
 void beginExtendedManagement(EventChannel ec, TypeID sessionID)
          Tell the authorization application that a protocol wishes to be "managed" using an ExtendedProtocolPresentation.
protected  void beginManagement(CapabilityEnvelope ce, TypeID sessionID)
          Call back used to handle a beginManagement event.
 void beginManagement(EventChannel ec, TypeID sessionID)
          Tell the authorization application that a protocol wishes to be "managed" using a basic ProtocolPresentation.
 CapabilityEnvelope[] getEnvelopes()
           
 EventChannel getEventChannel()
          An EventChannel connected to the peer domain.
 long getPeerID()
           
 void handle(BeesEvent ae)
          Callback used to handle BeesEvents directed to this Coroutine.
 void requestCapability(java.lang.String src, java.lang.String dst, byte[] auth)
          Request a capability from the Authenticator.
 java.lang.String toString()
           
 
Methods inherited from class bees.core.ResponderCoroutine
getResponder, setState
 
Methods inherited from class bees.core.Coroutine
cleanup, drop, finalize, getCoroutine, getID, getState, getThrowable, setThrowable, waitForCompletion, waitForCompletion, waitForState, waitForState
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STATE_REQUESTING

public static final int STATE_REQUESTING
Indicates the requesting Coroutine is waiting for a response.

STATE_CONNECTED

public static final int STATE_CONNECTED
Indicates the coroutine is connected to a peer.
Constructor Detail

AuthorizationCoroutine

public AuthorizationCoroutine(StateResponder sr,
                              AuthorizationCoroutine ac)
Construct an AuthorizationCoroutine with the given arguments.
Parameters:
sr - A StateResponder that will handle state transitions in this Coroutine.
ac - A connected AuthorizationCoroutine or null if a new connection is to be made.

AuthorizationCoroutine

public AuthorizationCoroutine(AuthorizationCoroutine ac)
Construct an AuthorizationCoroutine with the given argument.
Parameters:
ac - A connected AuthorizationCoroutine or null if a new connection is to be made.

AuthorizationCoroutine

public AuthorizationCoroutine()
Construct an empty AuthorizationCoroutine.
Method Detail

getEnvelopes

public CapabilityEnvelope[] getEnvelopes()
Returns:
The requested Capabilities, if authorization was successful.

getPeerID

public long getPeerID()
Returns:
The peer coroutine identifier.

getEventChannel

public EventChannel getEventChannel()
An EventChannel connected to the peer domain.

requestCapability

public void requestCapability(java.lang.String src,
                              java.lang.String dst,
                              byte[] auth)
Request a capability from the Authenticator.
Parameters:
ec - An EventChannel connected to the Authenticator.
src - The name of the capability, relative to the Authenticator's internal ObjectTree.
dst - The name to be placed in the CapabilityEnvelopes.
auth - Authorization data/signatures.

beginManagement

public void beginManagement(EventChannel ec,
                            TypeID sessionID)
Tell the authorization application that a protocol wishes to be "managed" using a basic ProtocolPresentation.
Parameters:
ec - The authorizer's event channel.
sessionID - The protocol session identifier that wishes to be managed.

beginExtendedManagement

public void beginExtendedManagement(EventChannel ec,
                                    TypeID sessionID)
Tell the authorization application that a protocol wishes to be "managed" using an ExtendedProtocolPresentation. In other words, the authorizer will tell the protocol about new neighbors, lost neighbors, and other messages supported by the extended presentation.
Parameters:
ec - The authorizer's event channel.
sessionID - The protocol session identifier that wishes to be managed.

beginManagement

protected void beginManagement(CapabilityEnvelope ce,
                               TypeID sessionID)
Call back used to handle a beginManagement event.
Parameters:
ce - An envelope containing the event channel of the requester.
sessionID - The protocol session identifier that wishes to be managed.

beginExtendedManagement

protected void beginExtendedManagement(CapabilityEnvelope ce,
                                       TypeID sessionID)
Call back used to handle a beginExtendedManagement event.
Parameters:
ce - An envelope containing the event channel of the requester.
sessionID - The protocol session identifier that wishes to be managed.

authorize

protected CapabilityEnvelope[] authorize(CapabilityEnvelope requester,
                                         java.lang.String src,
                                         java.lang.String dst,
                                         byte[] auth)
Call back used to handle an authorize event.
Parameters:
requester - The envelope containing the event channel.
src - The name of the capability, relative to the Authenticator's internal ObjectTree.
dst - The name to be placed in the CapabilityEnvelopes.
auth - Authorization data/signatures.
Returns:
An array of envelopes containing the requested capabilities.

handle

public void handle(BeesEvent ae)
Description copied from class: Coroutine
Callback used to handle BeesEvents directed to this Coroutine.
Overrides:
handle in class Coroutine
See Also:
Coroutine.handle(BeesEvent)

toString

public java.lang.String toString()
Overrides:
toString in class ResponderCoroutine
See Also:
Object.toString()

Bees v0.5.0 API

This documentation is Copyright (C) 2002 The University of Utah. All Rights Reserved. See the individual source files for distribution terms.
Documentation, software, and mailing lists for Bees v0.5.0 can be found at the Janos Project: http://www.cs.utah.edu/flux/janos/