TAuthManager performs user authentication and authorization for a Prado application. TAuthManager works together with a {@link IUserManager} module that can be specified via the {@link setUserManager UserManager} property. If an authorization fails, TAuthManager will try to redirect the client browser to a login page that is specified via the {@link setLoginPage LoginPage}. To login or logout a user, call {@link login} or {@link logout}, respectively. The {@link setAuthExpire AuthExpire} property can be used to define the time in seconds after which the authentication should expire. {@link setAllowAutoLogin AllowAutoLogin} specifies if the login information should be stored in a cookie to perform automatic login. Enabling this feature will cause that {@link setAuthExpire AuthExpire} has no effect since the user will be logged in again on authentication expiration. To load TAuthManager, configure it in application configuration as follows,
С версии: 3.0
Автор: Qiang Xue (qiang.xue@gmail.com)
Наследование: extends Prado\TModule
Пример #1
0
 public function testDoAuthentication()
 {
     throw new PHPUnit_Framework_IncompleteTestError();
     // Not yet finished, Session won't start because of headers :( :(
     $authManager = new TAuthManager();
     $authManager->setUserManager('users');
     $authManager->init(null);
     $authManager->setLoginPage('LoginPage');
     self::$app->raiseEvent('onAuthentication', self::$app, null);
 }