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);
 }