diff options
author | Ian Moore <ian.moore@fireeye.com> | 2015-07-29 12:12:26 -0400 |
---|---|---|
committer | Ian Moore <ian.moore@fireeye.com> | 2015-07-29 12:12:26 -0400 |
commit | 83e0bc0d26bd88925053ac3a6cc84edf7236f18e (patch) | |
tree | 18ac7e2f300934ba12dcdc20531b2de6813ffde9 /endpoints/lib/authinterface.php | |
parent | 76a645369fd0dc61bca879ec5f083464d62a7369 (diff) | |
download | phpvirtualbox-83e0bc0d26bd88925053ac3a6cc84edf7236f18e.zip phpvirtualbox-83e0bc0d26bd88925053ac3a6cc84edf7236f18e.tar.gz phpvirtualbox-83e0bc0d26bd88925053ac3a6cc84edf7236f18e.tar.bz2 |
Move source tree up one level
Diffstat (limited to 'endpoints/lib/authinterface.php')
-rw-r--r-- | endpoints/lib/authinterface.php | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/endpoints/lib/authinterface.php b/endpoints/lib/authinterface.php new file mode 100644 index 0000000..2905a0e --- /dev/null +++ b/endpoints/lib/authinterface.php @@ -0,0 +1,107 @@ +<?php
+/**
+ * Interface for phpVirtualBox authentication modules
+ *
+ * @author Ian Moore (imoore76 at yahoo dot com)
+ * @copyright Copyright (C) 2010-2015 Ian Moore (imoore76 at yahoo dot com)
+ * @version $Id: authinterface.php 595 2015-04-17 09:50:36Z imoore76 $
+ * @package phpVirtualBox
+ *
+ * A class wishing to implement this interface must also contain
+ * a list of capabilities describing its capabilities in a public
+ * object member array called capabilities.
+ *
+ * boolean canChangePassword - Users can change passwords
+ * boolean canModifyUsers - Users can be modified
+ * boolean canLogout - Users can log out
+ *
+ * E.g.
+ * var $capabilities = array(
+ * 'canChangePassword' => true,
+ * 'canModifyUsers' => true,
+ * 'canLogout' => true
+ * );
+ *
+ * The implementing class may also define a public autoLoginHook
+ * method that auto-populates $_SESSION. This would automatically
+ * log the user in, bypassing the login() function.
+ *
+ * E.g.
+ *
+ * function autoLoginHook()
+ * {
+ * global $_SESSION;
+ *
+ * // HTTP Authentication passthrough
+ * if ( isset($_SERVER['HTTP_X_WEBAUTH_USER']) )
+ * {
+ * $_SESSION['valid'] = true;
+ * $_SESSION['user'] = $_SERVER['HTTP_X_WEBAUTH_USER']];
+ * $_SESSION['admin'] = ($_SESSION['user'] === 'bob');
+ * $_SESSION['authCheckHeartbeat'] = time();
+ * }
+ * }
+ *
+ * Implementing classes should be prefixed with phpvbAuth. E.g.
+ * phpvbAuthMySiteAuth. authLib in config.php would then be set
+ * to 'MySiteAuth'
+ */
+interface phpvbAuth {
+
+ /**
+ *
+ * Log in function. Populates $_SESSION
+ * @param string $username user name
+ * @param string $password password
+ */
+ function login($username, $password);
+
+ /**
+ *
+ * Change password function.
+ * @param string $old old password
+ * @param string $new new password
+ * @return boolean true on success
+ */
+ function changePassword($old, $new);
+
+ /**
+ *
+ * Revalidate login info and set authCheckHeartbeat session variable.
+ * @param vboxconnector $vbox vboxconnector object instance
+ */
+ function heartbeat($vbox);
+
+ /**
+ *
+ * Log out user present in $_SESSION
+ * @param array $response response passed byref by API and populated within function
+ */
+ function logout(&$response);
+
+ /**
+ *
+ * Return a list of users
+ * @return array list of users
+ */
+ function listUsers();
+
+ /**
+ *
+ * Update user information such as password and admin status
+ * @param array $vboxRequest request passed from API representing the ajax request. Contains user, password and administration level.
+ * @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.
+ */
+ function updateUser($vboxRequest, $skipExistCheck);
+
+
+ /**
+ *
+ * Remove the user $user
+ * @param string $user Username to remove
+ */
+ function deleteUser($user);
+
+
+
+}
\ No newline at end of file |