Source for file SQLDatabaseMD5UsernamePasswordAuthNTokens.class.php

Documentation is available at SQLDatabaseMD5UsernamePasswordAuthNTokens.class.php

  1. <?php
  2. /**
  3. * @package harmoni.osid_v2.agentmanagement.authn_methods
  4. *
  5. * @copyright Copyright &copy; 2005, Middlebury College
  6. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  7. *
  8. * @version $Id: SQLDatabaseMD5UsernamePasswordAuthNTokens.class.php,v 1.7 2007/09/04 20:25:37 adamfranco Exp $
  9. */
  10.  
  11. require_once(dirname(__FILE__)."/UsernamePasswordAuthNTokens.class.php");
  12.  
  13. /**
  14. * This UserNamePasswordAuthNTokens class encrypts the password passed to it using
  15. * the database's MD5 function.
  16. *
  17. * @package harmoni.osid_v2.agentmanagement.authn_methods
  18. *
  19. * @copyright Copyright &copy; 2005, Middlebury College
  20. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  21. *
  22. * @version $Id: SQLDatabaseMD5UsernamePasswordAuthNTokens.class.php,v 1.7 2007/09/04 20:25:37 adamfranco Exp $
  23. */
  24. class SQLDatabaseMD5UsernamePasswordAuthNTokens
  25. extends UsernamePasswordAuthNTokens
  26. {
  27.  
  28. /**
  29. * Initialize this object for a set of authentication tokens. Set the
  30. * password to the encrypted version.
  31. *
  32. * @param mixed $tokens
  33. * @return void
  34. * @access public
  35. * @since 3/1/05
  36. */
  37. function initializeForTokens ( $tokens ) {
  38. ArgumentValidator::validate($tokens, ArrayValidatorRule::getRule());
  39. ArgumentValidator::validate($tokens['username'], StringValidatorRule::getRule());
  40. ArgumentValidator::validate($tokens['password'], StringValidatorRule::getRule());
  41. $this->_tokens = $tokens;
  42. $this->_identifier = $tokens['username'];
  43. // set the password to the encrypted version.
  44. $dbc = Services::getService("DatabaseManager");
  45. $dbId = $this->_configuration->getProperty('database_id');
  46. $passwordQuery = new SelectQuery;
  47. $passwordQuery->addColumn( "MD5('".addslashes($tokens['password'])."')",
  48. "encryptedPassword");
  49. $passwordResult = $dbc->query($passwordQuery, $dbId);
  50. $this->_tokens['password'] = $passwordResult->field("encryptedPassword");
  51. $passwordResult->free();
  52. }
  53. }
  54.  
  55. ?>

Documentation generated on Wed, 19 Sep 2007 10:26:39 -0400 by phpDocumentor 1.3.0RC3