Source for file NamePassTokenCollector.abstract.php

Documentation is available at NamePassTokenCollector.abstract.php

  1. <?php
  2. /**
  3. * @package harmoni.osid_v2.authentication
  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: NamePassTokenCollector.abstract.php,v 1.1 2005/03/16 22:48:41 adamfranco Exp $
  9. */
  10.  
  11. require_once(dirname(__FILE__)."/TokenCollector.abstract.php");
  12.  
  13. /**
  14. * The NamePassTokenCollector returns its tokens as an array with two elements:
  15. * 'username', 'password'. Descendents of this abstract class must implement
  16. * the collectName() and collectPassword() methods in addition to prompt inherited
  17. * from TokenCollector.
  18. *
  19. * @package harmoni.osid_v2.authentication
  20. *
  21. * @copyright Copyright &copy; 2005, Middlebury College
  22. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  23. *
  24. * @version $Id: NamePassTokenCollector.abstract.php,v 1.1 2005/03/16 22:48:41 adamfranco Exp $
  25. */
  26. class NamePassTokenCollector
  27. extends TokenCollector
  28. {
  29. /**
  30. * Collect any tokens that the user may have supplied. Reply NULL if none
  31. * are found. (This method uses the "Template Method" design pattern.)
  32. *
  33. * @return mixed
  34. * @access protected
  35. * @since 3/16/05
  36. */
  37. function collect () {
  38. // Allow for null passwords, but not null names.
  39. if ($this->collectName()) {
  40. return array(
  41. 'username' => $this->collectName(),
  42. 'password' => $this->collectPassword()
  43. );
  44. } else {
  45. return NULL;
  46. }
  47. }
  48. /**
  49. * Collect the name that the user may have supplied, Reply NULL if none
  50. * are found.
  51. *
  52. * @return mixed
  53. * @access public
  54. * @since 3/16/05
  55. */
  56. function collectName () {
  57. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  58. }
  59. /**
  60. * Collect the password that the user may have supplied, Reply NULL if none
  61. * are found.
  62. *
  63. * @return mixed
  64. * @access public
  65. * @since 3/16/05
  66. */
  67. function collectPassword () {
  68. die ("Method <b>".__FUNCTION__."()</b> declared in interface<b> ".__CLASS__."</b> has not been overloaded in a child class.");
  69. }
  70. }
  71.  
  72. ?>

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