-
Notifications
You must be signed in to change notification settings - Fork 1
/
Auth.php
49 lines (41 loc) · 1.01 KB
/
Auth.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
/**
* Celsus
*
* @category Celsus
* @copyright Copyright (c) 2010 Jamie Talbot (http://jamietalbot.com)
* @version $Id: Auth.php 69 2010-09-08 12:32:03Z jamie $
*/
/**
* Authentication functionality
*
* @defgroup Celsus_Auth Celsus Authentication
*/
/**
* Defines authentication, and allows adapters to be switched for mocking.
*
* @ingroup Celsus_Auth
*/
class Celsus_Auth extends Zend_Auth {
const EXCEPTION_AUTH_ERROR = 'EXCEPTION_AUTH_ERROR';
protected static $_authAdapter = null;
public static function setAuthAdapter(Zend_Auth_Adapter_Interface $authAdapter) {
self::$_authAdapter = $authAdapter;
}
/**
* Gets the application's auth adapter.
*
* @throws Celsus_Exception
* @return Celsus_Auth_Adapter_Interface
*/
public static function getAuthAdapter() {
if (null == self::$_authAdapter) {
throw new Celsus_Exception("Auth adapter has not been set!");
}
return self::$_authAdapter;
}
public static function resetAuthAdapter() {
self::$_authAdapter = null;
}
}
?>