org.nst.pasientlink.authenticator
Class AuthenticatorStorage

java.lang.Object
  |
  +--org.nst.pasientlink.authenticator.AuthenticatorStorage

public class AuthenticatorStorage
extends java.lang.Object


Field Summary
private  org.apache.log4j.Logger logger
           
private static com.javaexchange.dbConnectionBroker.DbConnectionBroker myDbBroker
           
 
Constructor Summary
AuthenticatorStorage(java.util.Properties myProperties)
          Constructor.
 
Method Summary
 boolean changePassword(java.lang.String myUserID, byte[] myNewPasswordHash)
          changePassword updates the password property for a specified userid in the database
 boolean createUser(java.lang.String myUserID, java.lang.String myUserDescription, byte[] myPasswordHash, java.lang.String myGSMSubscriberID)
          createUser creates a user entry in storage from the specified input parameters, given that a user with the same userid does not exist.
private  java.sql.Connection getConnection()
          getConnection gets a Connection object from the connection pool sets autocommit to false, and returns the object.
 java.lang.String getDescription(java.lang.String myUserID)
          getDescription retuns the descriptiopn for a specified user.
 java.lang.String getGSMSubscriberID(java.lang.String myUserID)
          getGSMSubscriberID retuns the GSM subscriber ID for a specified user.
 byte[] getPasswordHash(java.lang.String myUserID)
          getPasswordHash retuns the password hash for a specified user.
 boolean removeUser(java.lang.String myUserID)
          removeUser removes a specified userid from the database
 boolean updateUserInfo(java.lang.String myUserID, java.lang.String myDescription, java.lang.String myGSMSubscriberID)
          updateUserInfo updates GSM subscriber ID and description for a specified user
 boolean userExists(java.lang.String myUserID)
          getUserExists verifies the existence of a specified user in the database
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

myDbBroker

private static com.javaexchange.dbConnectionBroker.DbConnectionBroker myDbBroker

logger

private org.apache.log4j.Logger logger
Constructor Detail

AuthenticatorStorage

public AuthenticatorStorage(java.util.Properties myProperties)
Constructor. Initializes database connection pool from configuration, and sets up logger.
Parameters:
myProperties - Properties containing configuration properties
See Also:
com.javaexchange.dbConnectionBroker.DBConnectionBroker
Method Detail

createUser

public boolean createUser(java.lang.String myUserID,
                          java.lang.String myUserDescription,
                          byte[] myPasswordHash,
                          java.lang.String myGSMSubscriberID)
createUser creates a user entry in storage from the specified input parameters, given that a user with the same userid does not exist.
Parameters:
myUserID - String containing userID of the new user
myUserDescription - String containing a description, typically name, of the new user
myPasswordHash - byte array containing password hash for the new user
myGSMSubscriberID - String containing the GSM phone number of the new user
Returns:
a boolean value indicating whether the user was created (true) or not (false)

removeUser

public boolean removeUser(java.lang.String myUserID)
removeUser removes a specified userid from the database
Parameters:
myUserID - String containing userID of the soon-to-be-gone user
Returns:
a boolean value indicating whether the user was removed (true) or not (false)

changePassword

public boolean changePassword(java.lang.String myUserID,
                              byte[] myNewPasswordHash)
changePassword updates the password property for a specified userid in the database
Parameters:
myUserID - String containing userID of the user
myNewPasswordHash - byte array containing the password hash of the new password
Returns:
a boolean value indicating whether the password was changed (true) or not (false)

userExists

public boolean userExists(java.lang.String myUserID)
getUserExists verifies the existence of a specified user in the database
Parameters:
myUserID - String containing a user_id
Returns:
boolean indicating whether (true) or not (falsE) the specified user exists in the database

getGSMSubscriberID

public java.lang.String getGSMSubscriberID(java.lang.String myUserID)
getGSMSubscriberID retuns the GSM subscriber ID for a specified user.
Parameters:
myUserID - String containing a user id
Returns:
String containing GSM Subscriber ID, or null if the user did not exist

getDescription

public java.lang.String getDescription(java.lang.String myUserID)
getDescription retuns the descriptiopn for a specified user.
Parameters:
myUserID - String containing a user id
Returns:
String containing description, or null if the user did not exist

getPasswordHash

public byte[] getPasswordHash(java.lang.String myUserID)
getPasswordHash retuns the password hash for a specified user.
Parameters:
myUserID - String containing a user id
Returns:
byte[] containing password hash, or null if the user did not exist

updateUserInfo

public boolean updateUserInfo(java.lang.String myUserID,
                              java.lang.String myDescription,
                              java.lang.String myGSMSubscriberID)
updateUserInfo updates GSM subscriber ID and description for a specified user
Parameters:
myUserID - String containing userID of the user
myDescription - String containing a description of the user
myGSMSubscriberID - String containing the GSM subscriber ID of the user
Returns:
a boolean value indicating whether the user information was update (true) or not (false)

getConnection

private java.sql.Connection getConnection()
getConnection gets a Connection object from the connection pool sets autocommit to false, and returns the object. Invoking object has the responsibility for releasing the connection upon completion. The connection pool must have been initialized successfully for this method to return a valid Connection object instance.
Returns:
a Connection object with autocommit set to false


Copyright © 2002 Norwegian Centre for Telemedicine. All Rights Reserved.