Source for file UsernamePasswordAuthNTokens.class.php

Documentation is available at UsernamePasswordAuthNTokens.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: UsernamePasswordAuthNTokens.class.php,v 1.4 2005/04/07 19:42:13 adamfranco Exp $
  9. */
  10.  
  11. require_once(dirname(__FILE__)."/AuthNTokens.abstract.php");
  12.  
  13. /**
  14. * UsernamePasswordAuthNTokens is used by AuthNMethods that wrap systems that
  15. * authenticate via a Username/Password pair of strings.
  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: UsernamePasswordAuthNTokens.class.php,v 1.4 2005/04/07 19:42:13 adamfranco Exp $
  23. */
  24. class UsernamePasswordAuthNTokens
  25. extends AuthNTokens
  26. {
  27.  
  28. /**
  29. * Initialize this object for a set of authentication tokens.
  30. *
  31. * @param mixed $tokens
  32. * @return void
  33. * @access public
  34. * @since 3/1/05
  35. */
  36. function initializeForTokens ( $tokens ) {
  37. ArgumentValidator::validate($tokens, ArrayValidatorRule::getRule());
  38. ArgumentValidator::validate($tokens['username'], StringValidatorRule::getRule());
  39. ArgumentValidator::validate($tokens['password'], StringValidatorRule::getRule());
  40. $this->_tokens = $tokens;
  41. $this->_identifier = $tokens['username'];
  42. }
  43. /**
  44. * Initialize this object for an identifier. The identifier is often a
  45. * username, but can be any string as long as it is unique within a given
  46. * AuthNMethod.
  47. *
  48. * @param string $identifier
  49. * @return void
  50. * @access public
  51. * @since 3/1/05
  52. */
  53. function initializeForIdentifier ( $identifier ) {
  54. ArgumentValidator::validate($identifier, StringValidatorRule::getRule());
  55. $this->_identifier = $identifier;
  56. $this->_tokens = array(
  57. 'username' => $identifier,
  58. 'password' => ''
  59. );
  60. }
  61. /**
  62. * Return the username.
  63. *
  64. * @return string
  65. * @access public
  66. * @since 3/1/05
  67. */
  68. function getUsername () {
  69. return $this->_identifier;
  70. }
  71. /**
  72. * Return the password.
  73. *
  74. * @return string
  75. * @access public
  76. * @since 3/1/05
  77. */
  78. function getPassword () {
  79. return $this->_tokens['password'];
  80. }
  81. }
  82.  
  83. ?>

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