|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.ibm.tspaces.ac.AuthChecker
This class will handle the authentication of a User/Password pair without sending the Password over the network. The class contains both the code that runs at the server and at the Client. The "database" of userid/passwordkeys is a Hashtable that is provided initially by the server via the setUsers() method. At the Client side, AuthChecker is called with the following method calls
try {
AuthChecker authck = new AuthChecker();
authck.clientLogin(ObjectOutputStream s, String user, String password);
} catch (Exception e) {
}
At the Server side, AuthChecker is used as follows.
try {
AuthChecker authck = TSServer.getAuthChecker();
authck.authenticate(ObjectInputStream s);
} catch (Exception ae) {
}
Additional notes.
Currently the Hashtable that is contains the Userid and Password keys
is stored in the Admin space. It is also saved in a backup file that
is specified by the configuration file. The backup file is so that the
server can be reinitialized without losing the userid and password
information.
The authentication is pretty lame. Basically all this does is remove the exposure of having the user password in clear text be sprayed over the net and hard drive. The next step would be to authenticate using a challenge protocol (or some other protocol.) This is left as an exercise for future T Spaces developers. The book Java Network Programming by Hughes etal, has a good section on how to do this in theory but in practice, one needs to use the facilities that will be available in Java 1.2 JCE.
| Field Summary | |
static java.lang.String |
USERS_TUPLE
Tuple Identifier (Field[0]) |
| Constructor Summary | |
AuthChecker()
Default constructor This will obtain an implementation of SHA (SecureHashAlgorithm) Sun provides this implementation. |
|
| Method Summary | |
boolean |
authenticate(java.io.ObjectInputStream objectIn_)
This is the authentication method that is invoked by the server at the start of a session. |
boolean |
authenticate(java.lang.String user_,
java.lang.Object password_)
This is the authentication method that is invoked by the server when it has the userid and password in hand (instead of an ObjectStream) It will then validate the user/key combination by checking the Hashtable where we have stored all the user/key combinations. |
void |
clientLogin(java.io.ObjectOutputStream oos_,
java.lang.String user_,
java.lang.String password_)
This is the method that the client issues when it makes the connection to the server and only has the cleartext password. |
boolean |
contains(java.lang.String user)
Return true if the specified user exists in the HashTable |
java.math.BigInteger |
getKeyFromPassword(java.lang.String password)
This will take a Password in cleartext and convert it to a key based on the SHA MessageDigest algoritms |
java.lang.String |
getUser()
Return the Userid that has been validated. |
java.util.Enumeration |
getUserElements()
Return an enumeration of Userid Elements in the Hashtable Each element in the Enumeration will be a Userid String. |
java.util.Hashtable |
getUsers()
Get a reference to the Hashtable |
static java.util.Hashtable |
readUserFile(java.lang.String filename)
readUserFile will read a file that contains the user and password Key info |
static java.util.Hashtable |
readUserFileTuple(TupleSpace ts)
readUserFileTuple will read the UserFile object from the Admin space |
void |
setSeed(java.lang.String seed)
Set the Encryption seed. |
void |
setUsers(java.util.Hashtable users)
Set the Hashtable that contains the user/key combinations |
void |
storePassword(java.lang.String user,
java.lang.String password)
StorePassword will update the list of passwords that are maintained |
boolean |
verifyUser(java.lang.String user,
java.lang.String password)
Method that verififies a user |
static void |
writeUserFile(java.lang.String filename,
java.util.Hashtable hashtable)
writeUserFile will write a file that contains the user and password Key info |
static void |
writeUserFileTuple(TupleSpace ts,
java.util.Hashtable userTable)
writeUserFileTuple will write the UserFile to the Admin space |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final java.lang.String USERS_TUPLE
| Constructor Detail |
public AuthChecker()
throws TupleSpaceCommunicationException
| Method Detail |
public void clientLogin(java.io.ObjectOutputStream oos_,
java.lang.String user_,
java.lang.String password_)
throws java.io.IOException
oos_ - The stream that we're talking onuser_ - The user that is to be authenticatedpassword_ - The password (clear text) that is to be checked.
public boolean authenticate(java.io.ObjectInputStream objectIn_)
throws TupleSpaceServerException
objectln_ - Inputstream from which to read authentication objects
public boolean authenticate(java.lang.String user_,
java.lang.Object password_)
throws TupleSpaceServerException
user_ - Useridpassword_ - Passwordpublic java.lang.String getUser()
public boolean verifyUser(java.lang.String user,
java.lang.String password)
user - Verify this userpublic void setSeed(java.lang.String seed)
public void setUsers(java.util.Hashtable users)
users - hash these guyspublic java.util.Hashtable getUsers()
public java.util.Enumeration getUserElements()
public boolean contains(java.lang.String user)
public void storePassword(java.lang.String user,
java.lang.String password)
user - Store the password for this userpassword - Store this password for above userpublic static java.util.Hashtable readUserFile(java.lang.String filename)
filename - Read this file and return the hashtable
public static void writeUserFile(java.lang.String filename,
java.util.Hashtable hashtable)
filename - Write into this filenamehashtable - Write this hashtable into the specified filenamepublic static java.util.Hashtable readUserFileTuple(TupleSpace ts)
ts - The admin TS?
public static void writeUserFileTuple(TupleSpace ts,
java.util.Hashtable userTable)
ts - write to this spaceuserTable - Write this hashtablepublic java.math.BigInteger getKeyFromPassword(java.lang.String password)
password - Turn this password into glorp
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||