Devel:Auth

From PmaWiki

Jump to: navigation, search

Contents

[edit] Basics

To implement own authentication scheme, all you need is to write a PHP script handling it, place it as libraries/auth/NAME.auth.lib.php and select it's use in configuration.

The file needs to implement following functions:

[edit] PMA_auth

Function to display authentication form. You can check if user has just logged out by looking at $_REQUEST['old_usr'] variable, which contains user name of logged out user in this case. The login form should post to index.php.

[edit] PMA_auth_check

Function to obtain credentials from the login POST or from SESSION and store them in global variables PHP_AUTH_USER and PHP_AUTH_PW. Core phpMyAdmin code then verifies whether user can connect to the MySQL server.

[edit] PMA_auth_set_user

After provided credentials are successfully verified against MySQL, this function is called. It needs to store the credentials to be available for further usage. At least it has to do following:

   $GLOBALS['cfg']['Server']['user']     = $GLOBALS['PHP_AUTH_USER'];
   $GLOBALS['cfg']['Server']['password'] = $GLOBALS['PHP_AUTH_PW'];

But it might also store login information in cookies or whatver other storage.

[edit] PMA_auth_fails

Called when authentication against MySQL fails. At the end it should call PMA_auth, but meanwhile it could check for cause of failure (check libraries/auth/cookie.auth.lib.php for example) and show some meaningful error messages to user.

Advertisement