agentland.util
Class UserInfoAgent

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--metaglue.AgentAgent
                          |
                          +--agentland.util.GoodAgent
                                |
                                +--agentland.util.UserInfoAgent

public class UserInfoAgent
extends GoodAgent
implements UserInfo

The UserInfo agent is used to get info about the user in a more-or-less secure fashion. Since this information can include passwords, email locations, chat program user ids, and other items that the user may want kept secret, we will avoid passing this information in the clear as much as possible.

The data is stored, encrypted, in a JDBC database. The agent uses the blowfish algorithm to encrypt the data using a pass phrase found in the .metaglue-userinfo file. The database can also be set up to only give read access to the user, but most databases don't have really fantastic security.

Note that .metaglue-userinfo should be stored with mode 600, so that no one other than the given user id can read it. If you don't do this, your data is not secure!

There can only be one instance of UserInfoAgent for each user. Therefore, UserInfoAgent will kill itself off if it's running without a designation, or if the designation does not match the current user id.

UserInfoAgent is probably vulnerable to spoofing attacks; an agent could be written to hunt through the catalog for any UserInfoAgents out there and ask them for information.

Currently, this agent must run on a Unix box, since the user.home system property is not set correctly on Windows NT.

See Also:
Serialized Form

Inner classes inherited from class metaglue.AgentAgent
AgentAgent.Attribute
 
Fields inherited from class agentland.util.GoodAgent
alert, notifier
 
Fields inherited from class java.rmi.server.RemoteObject
ref
 
Fields inherited from interface metaglue.Agent
ALIVE, DIED, NO_METAGLUE, NOT_RUNNING, STARTING
 
Constructor Summary
UserInfoAgent()
           
 
Method Summary
 Properties getProperties()
          Gets all the properties in the database, and returns them as a Properties object.
 String getProperty(String prop)
          Gets a property value.
static void main(String[] args)
          Creates an initial .metaglue-userinfo file with a random 40 character key.
 Object setProperty(String key, String val)
          Sets a property in the database, with encryption.
 
Methods inherited from class agentland.util.GoodAgent
addSpy, addSpy, alert, alertString, beep, error, getAlert, getHistory, getHistoryElement, getPersistentMap, log, notify, removeSpy, removeSpy, resetHistory, safeRely, safeRely, safeRely, setNiceLogName, tell
 
Methods inherited from class metaglue.AgentAgent
addMonitor, alive, defrost, defrostAll, defrostBoolean, defrostInt, defrostString, fixAttribute, fixAttribute, freeze, freeze, freeze, freezeAll, freezeVar, getAgentID, getAttribute, getCatalog, getCatalogID, getDesignation, getFrozenVariables, getLogLevel, getMetaglueAgent, getMetaglueAgentID, getOccupation, getSociety, log, log, obtainMetaglueAgent, obtainMetaglueAgent, obtainMetaglueAgentByName, reliesOn, reliesOn, reliesOn, reliesOnSynch, removeFrozen, replaceExceptionHandler, setFreezeName, setLogLevel, setLogName, shutdown, startAgent, startAgentOn, startAgentOn, startup, status, tiedTo, tiedTo, tiedTo, tiedTo, tieToDesignation, whereAreYou
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UserInfoAgent

public UserInfoAgent()
              throws RemoteException
Method Detail

getProperties

public Properties getProperties()
Gets all the properties in the database, and returns them as a Properties object.
Overrides:
getProperties in class AgentAgent
Returns:
a value of type 'Properties'. The properties object.

getProperty

public String getProperty(String prop)
                   throws RemoteException
Gets a property value.
Specified by:
getProperty in interface UserInfo
Parameters:
prop - a value of type 'String'. This is the key used to look up the value in the database.
Returns:
a value of type 'String'. This is the unencrypted result.
Throws:
RemoteException - if an error occurs

setProperty

public Object setProperty(String key,
                          String val)
                   throws RemoteException
Sets a property in the database, with encryption.
Specified by:
setProperty in interface UserInfo
Parameters:
key - a value of type 'String'. The name of the property.
val - a value of type 'String'. The value to assign to the property.
Returns:
a value of type 'Object' This is the old value of the property, if any (returns null if no previous value).
Throws:
RemoteException - if an error occurs

main

public static void main(String[] args)
Creates an initial .metaglue-userinfo file with a random 40 character key. The ensuing file should be protected with a "chmod 600" command so only the user can read it.
Parameters:
args[] - a value of type 'String'. Currently no arguments are processed.