Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

authinterface.php 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. /**
  3. * Interface for phpVirtualBox authentication modules
  4. *
  5. * @author Ian Moore (imoore76 at yahoo dot com)
  6. * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
  7. * @version $Id: authinterface.php 595 2015-04-17 09:50:36Z imoore76 $
  8. * @package phpVirtualBox
  9. *
  10. * A class wishing to implement this interface must also contain
  11. * a list of capabilities describing its capabilities in a public
  12. * object member array called capabilities.
  13. *
  14. * boolean canChangePassword - Users can change passwords
  15. * boolean canModifyUsers - Users can be modified
  16. * boolean canLogout - Users can log out
  17. *
  18. * E.g.
  19. * var $capabilities = array(
  20. * 'canChangePassword' => true,
  21. * 'canModifyUsers' => true,
  22. * 'canLogout' => true
  23. * );
  24. *
  25. * The implementing class may also define a public autoLoginHook
  26. * method that auto-populates $_SESSION. This would automatically
  27. * log the user in, bypassing the login() function.
  28. *
  29. * E.g.
  30. *
  31. * function autoLoginHook()
  32. * {
  33. * global $_SESSION;
  34. *
  35. * // HTTP Authentication passthrough
  36. * if ( isset($_SERVER['HTTP_X_WEBAUTH_USER']) )
  37. * {
  38. * $_SESSION['valid'] = true;
  39. * $_SESSION['user'] = $_SERVER['HTTP_X_WEBAUTH_USER']];
  40. * $_SESSION['admin'] = ($_SESSION['user'] === 'bob');
  41. * $_SESSION['authCheckHeartbeat'] = time();
  42. * }
  43. * }
  44. *
  45. * Implementing classes should be prefixed with phpvbAuth. E.g.
  46. * phpvbAuthMySiteAuth. authLib in config.php would then be set
  47. * to 'MySiteAuth'
  48. */
  49. interface phpvbAuth {
  50. /**
  51. *
  52. * Log in function. Populates $_SESSION
  53. * @param string $username user name
  54. * @param string $password password
  55. */
  56. function login($username, $password);
  57. /**
  58. *
  59. * Change password function.
  60. * @param string $old old password
  61. * @param string $new new password
  62. * @return boolean true on success
  63. */
  64. function changePassword($old, $new);
  65. /**
  66. *
  67. * Revalidate login info and set authCheckHeartbeat session variable.
  68. * @param vboxconnector $vbox vboxconnector object instance
  69. */
  70. function heartbeat($vbox);
  71. /**
  72. *
  73. * Log out user present in $_SESSION
  74. * @param array $response response passed byref by API and populated within function
  75. */
  76. function logout(&$response);
  77. /**
  78. *
  79. * Return a list of users
  80. * @return array list of users
  81. */
  82. function listUsers();
  83. /**
  84. *
  85. * Update user information such as password and admin status
  86. * @param array $vboxRequest request passed from API representing the ajax request. Contains user, password and administration level.
  87. * @param boolean $skipExistCheck Do not check that the user exists first. Essentially, if this is set and the user does not exist, it is added.
  88. */
  89. function updateUser($vboxRequest, $skipExistCheck);
  90. /**
  91. *
  92. * Remove the user $user
  93. * @param string $user Username to remove
  94. */
  95. function deleteUser($user);
  96. }