authorization
Class LifeCycleHandler

java.lang.Object
  extended by com.wrq.vhi.script.api.LifeCycleEventHandler
      extended by authorization.LifeCycleHandler
All Implemented Interfaces:
com.wrq.vhi.script.api.EventHandler

public class LifeCycleHandler
extends com.wrq.vhi.script.api.LifeCycleEventHandler

Implement client authentication and authorization.

This class implements the modelLoaded(com.wrq.vhi.script.api.ModelLoadedEvent) and modelUnloaded(com.wrq.vhi.script.api.ModelUnloadedEvent) events to load and unload a user database stored in the model hashmap.

This class also implements the authenticateUser(com.wrq.vhi.script.api.AuthenticateUserEvent) event to

  1. Permit access to this model only to a small set of authorized users.
  2. Supply a unique host user name and password which will be used to login to the host application.


Field Summary
static java.lang.String description
           
 
Fields inherited from interface com.wrq.vhi.script.api.EventHandler
DEFAULT_TIMEOUT
 
Constructor Summary
LifeCycleHandler()
           
 
Method Summary
 boolean authenticateUser(com.wrq.vhi.script.api.AuthenticateUserEvent event)
          Authenticate a user attempting to connect to the model.
 void modelLoaded(com.wrq.vhi.script.api.ModelLoadedEvent event)
          Initialize the client authorization and host credential databases.
 void modelUnloaded(com.wrq.vhi.script.api.ModelUnloadedEvent event)
          Delete the client authorization and host credential databases.
 
Methods inherited from class com.wrq.vhi.script.api.LifeCycleEventHandler
clientSessionCreated, clientSessionDestroyed, hostSessionCreated, hostSessionDestroyed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

description

public static final java.lang.String description
See Also:
Constant Field Values
Constructor Detail

LifeCycleHandler

public LifeCycleHandler()
Method Detail

modelLoaded

public void modelLoaded(com.wrq.vhi.script.api.ModelLoadedEvent event)
Initialize the client authorization and host credential databases.

This method creates object instances which implement the IUserAuthorizer and IHostCredentialMap interfaces and stores them in the model hashmap for use by the authenticateUser(com.wrq.vhi.script.api.AuthenticateUserEvent) and executeProcedure events.

Overrides:
modelLoaded in class com.wrq.vhi.script.api.LifeCycleEventHandler
Parameters:
event - the event instance

modelUnloaded

public void modelUnloaded(com.wrq.vhi.script.api.ModelUnloadedEvent event)
Delete the client authorization and host credential databases.

These databases are removed from the model hashmap as the model is unloaded. This is not strictly required: the model hashmap and its contents will be disposed of by the script manager. But if the hashmap contained a resource which needed to be closed, this would be the time to do it.

Overrides:
modelUnloaded in class com.wrq.vhi.script.api.LifeCycleEventHandler
Parameters:
event - the event instance

authenticateUser

public boolean authenticateUser(com.wrq.vhi.script.api.AuthenticateUserEvent event)
                         throws com.wrq.apptrieve.agent.ApptrieveException
Authenticate a user attempting to connect to the model.

This method first authenticates the client credentials against the set of users allowed to access this model.

If access is permitted, the userID and password model variables are initialized with the host credentials for this client before logging in to the host.

Overrides:
authenticateUser in class com.wrq.vhi.script.api.LifeCycleEventHandler
Parameters:
event - the event instance
Returns:
true to allow the connection or false to reject it
Throws:
com.wrq.apptrieve.agent.ApptrieveException