2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Abstract class for the authentication plugins
8 if (! defined('PHPMYADMIN')) {
13 * Provides a common interface that will have to be implemented by all of the
14 * authentication plugins.
18 abstract class AuthenticationPlugin
21 * Displays authentication form
25 abstract public function auth();
28 * Gets advanced authentication settings
32 abstract public function authCheck();
35 * Set the user and password after last checkings if required
39 abstract public function authSetUser();
42 * Stores user credentials after successful login.
46 public function storeUserCredentials()
51 * User is not allowed to login to MySQL -> authentication failed
55 abstract public function authFails();
58 * Returns error message for failed authentication.
62 public function getErrorMessage()
64 if (! empty($GLOBALS['login_without_password_is_forbidden'])) {
66 'Login without a password is forbidden by configuration'
67 . ' (see AllowNoPassword)'
69 } elseif (! empty($GLOBALS['allowDeny_forbidden'])) {
70 return __('Access denied!');
71 } elseif (! empty($GLOBALS['no_activity'])) {
73 __('No activity within %s seconds; please log in again.'),
74 $GLOBALS['cfg']['LoginCookieValidity']
77 $dbi_error = $GLOBALS['dbi']->getError();
78 if (! empty($dbi_error)) {
79 return PMA_sanitize($dbi_error);
80 } elseif (isset($GLOBALS['errno'])) {
81 return '#' . $GLOBALS['errno'] . ' '
82 . __('Cannot log in to the MySQL server');
84 return __('Cannot log in to the MySQL server');
90 * Callback when user changes password.
92 * @param string $password New password to set
96 public function handlePasswordChange($password)