mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 09:49:30 +02:00
Rename vauth to Auth
This commit is contained in:
parent
58a3ab692e
commit
ead4cf2a0e
6 changed files with 19 additions and 22 deletions
|
@ -78,11 +78,10 @@ session_cookielife = 0
|
||||||
session_cookiesecure = 0
|
session_cookiesecure = 0
|
||||||
|
|
||||||
; Auth Methods
|
; Auth Methods
|
||||||
; This defines which auth methods vauth will attempt
|
; This defines which auth methods Auth will attempt to use and in which order.
|
||||||
; to use and in which order, if auto_create isn't enabled
|
; If auto_create isn't enabled the user must exist locally.
|
||||||
; The user must exist locally. Local method uses PHP's PAM Auth module
|
|
||||||
; DEFAULT: mysql
|
; DEFAULT: mysql
|
||||||
; VALUES: mysql,ldap,http,local
|
; VALUES: mysql,ldap,http,pam
|
||||||
auth_methods = "mysql"
|
auth_methods = "mysql"
|
||||||
|
|
||||||
; Automatic local password updating
|
; Automatic local password updating
|
||||||
|
|
|
@ -21,14 +21,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* vauth Class
|
|
||||||
*
|
*
|
||||||
* This class handles all of the session related stuff in Ampache
|
* This class handles all of the session related stuff in Ampache
|
||||||
* it takes over for the vauth libs, and takes some stuff out of other
|
* it takes over for the vauth libs, and takes some stuff out of other
|
||||||
* classes where it didn't belong
|
* classes where it didn't belong.
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
class vauth {
|
class Auth {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -85,11 +83,12 @@ class vauth {
|
||||||
} // logout
|
} // logout
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* authenticate
|
* login
|
||||||
|
*
|
||||||
* This takes a username and password and then returns the results
|
* This takes a username and password and then returns the results
|
||||||
* based on what happens when we try to do the auth.
|
* based on what happens when we try to do the auth.
|
||||||
*/
|
*/
|
||||||
public static function authenticate($username, $password) {
|
public static function login($username, $password) {
|
||||||
|
|
||||||
// Foreach the auth methods
|
// Foreach the auth methods
|
||||||
foreach (Config::get('auth_methods') as $method) {
|
foreach (Config::get('auth_methods') as $method) {
|
||||||
|
@ -97,7 +96,7 @@ class vauth {
|
||||||
// Build the function name and call it
|
// Build the function name and call it
|
||||||
$function_name = $method . '_auth';
|
$function_name = $method . '_auth';
|
||||||
|
|
||||||
if (!method_exists('vauth', $function_name)) {
|
if (!method_exists('Auth', $function_name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -110,7 +109,7 @@ class vauth {
|
||||||
|
|
||||||
return $results;
|
return $results;
|
||||||
|
|
||||||
} // authenticate
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mysql_auth
|
* mysql_auth
|
||||||
|
@ -158,7 +157,7 @@ class vauth {
|
||||||
$results['error'] = 'MySQL login attempt failed';
|
$results['error'] = 'MySQL login attempt failed';
|
||||||
return $results;
|
return $results;
|
||||||
|
|
||||||
} // mysql_auth
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* local_auth
|
* local_auth
|
||||||
|
@ -325,6 +324,5 @@ class vauth {
|
||||||
return $results;
|
return $results;
|
||||||
} // http_auth
|
} // http_auth
|
||||||
|
|
||||||
} // end of vauth class
|
}
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -82,7 +82,7 @@ if (isset($results['user_ip_cardinality']) && !$results['user_ip_cardinality'])
|
||||||
$results['user_ip_cardinality'] = 42;
|
$results['user_ip_cardinality'] = 42;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Variables needed for vauth class */
|
/* Variables needed for Auth class */
|
||||||
$results['cookie_path'] = $results['raw_web_path'];
|
$results['cookie_path'] = $results['raw_web_path'];
|
||||||
$results['cookie_domain'] = $_SERVER['SERVER_NAME'];
|
$results['cookie_domain'] = $_SERVER['SERVER_NAME'];
|
||||||
$results['cookie_life'] = $results['session_cookielife'];
|
$results['cookie_life'] = $results['session_cookielife'];
|
||||||
|
@ -133,7 +133,7 @@ set_memory_limit($results['memory_limit']);
|
||||||
if (!defined('NO_SESSION') && Config::get('use_auth')) {
|
if (!defined('NO_SESSION') && Config::get('use_auth')) {
|
||||||
/* Verify their session */
|
/* Verify their session */
|
||||||
if (!Session::exists('interface', $_COOKIE[Config::get('session_name')])) {
|
if (!Session::exists('interface', $_COOKIE[Config::get('session_name')])) {
|
||||||
vauth::logout($_COOKIE[Config::get('session_name')]);
|
Auth::logout($_COOKIE[Config::get('session_name')]);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ if (!defined('NO_SESSION') && Config::get('use_auth')) {
|
||||||
|
|
||||||
/* If the user ID doesn't exist deny them */
|
/* If the user ID doesn't exist deny them */
|
||||||
if (!$GLOBALS['user']->id && !Config::get('demo_mode')) {
|
if (!$GLOBALS['user']->id && !Config::get('demo_mode')) {
|
||||||
vauth::logout(session_id());
|
Auth::logout(session_id());
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,7 +181,7 @@ elseif (!Config::get('use_auth')) {
|
||||||
$GLOBALS['user']->access = $auth['access'];
|
$GLOBALS['user']->access = $auth['access'];
|
||||||
}
|
}
|
||||||
if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) {
|
if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) {
|
||||||
vauth::logout(session_id()); exit;
|
Auth::logout(session_id()); exit;
|
||||||
}
|
}
|
||||||
$GLOBALS['user']->update_last_seen();
|
$GLOBALS['user']->update_last_seen();
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ if (($_POST['username'] && $_POST['password']) ||
|
||||||
$password = '';
|
$password = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
$auth = vauth::authenticate($username, $password);
|
$auth = Auth::login($username, $password);
|
||||||
|
|
||||||
if ($auth['success']) {
|
if ($auth['success']) {
|
||||||
$username = $auth['username'];
|
$username = $auth['username'];
|
||||||
|
|
|
@ -27,5 +27,5 @@
|
||||||
require_once 'lib/init.php';
|
require_once 'lib/init.php';
|
||||||
|
|
||||||
// To end a legitimate session, just call logout.
|
// To end a legitimate session, just call logout.
|
||||||
vauth::logout('',false);
|
Auth::logout('',false);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -54,7 +54,7 @@ new config file.</p>
|
||||||
values from the ampache.cfg.php.dist file will be used.</p>
|
values from the ampache.cfg.php.dist file will be used.</p>
|
||||||
|
|
||||||
<strong>auth_methods</strong> (<i>mysql</i>)<br />
|
<strong>auth_methods</strong> (<i>mysql</i>)<br />
|
||||||
This defines which auth methods vauth will attempt to use and in which order, if auto_create isn't enabled.
|
This defines which auth methods Auth will attempt to use and in which order, if auto_create isn't enabled.
|
||||||
The user must exist locally as well<br />
|
The user must exist locally as well<br />
|
||||||
<br />
|
<br />
|
||||||
<strong>tag_order</strong> (<i>id3v2,id3v1,vorbiscomment,quicktime,ape,asf</i>)<br />
|
<strong>tag_order</strong> (<i>id3v2,id3v1,vorbiscomment,quicktime,ape,asf</i>)<br />
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue