[ Index ]
 

Code source de PRADO 3.0.6

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/framework/Security/ -> TAuthManager.php (sommaire)

TAuthManager class file

Author: Qiang Xue <qiang.xue@gmail.com>
Copyright: Copyright © 2005 PradoSoft
License: http://www.pradosoft.com/license/
Version: $Id: TAuthManager.php 1397 2006-09-07 07:55:53Z wei $
Poids: 292 lignes (9 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 0 fichiers

Définit 1 class

TAuthManager:: (15 méthodes):
  init()
  getUserManager()
  setUserManager()
  getLoginPage()
  setLoginPage()
  doAuthentication()
  doAuthorization()
  leave()
  getReturnUrl()
  onAuthenticate()
  onAuthorize()
  generateUserSessionKey()
  updateSessionUser()
  login()
  logout()


Classe: TAuthManager  - X-Ref

TAuthManager class

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.

To load TAuthManager, configure it in application configuration as follows,
<module id="auth" class="System.Security.TAuthManager" UserManager="users" LoginPage="login" />
<module id="users" class="System.Security.TUserManager" />

init($config)   X-Ref
Initializes this module.
This method is required by the IModule interface.

param: TXmlElement configuration for this module, can be null

getUserManager()   X-Ref

return: IUserManager user manager instance

setUserManager($provider)   X-Ref

param: string|IUserManager the user manager module ID or the user mananger object

getLoginPage()   X-Ref

return: string path of login page should login is required

setLoginPage($pagePath)   X-Ref
Sets the login page that the client browser will be redirected to if login is needed.
Login page should be specified in the format of page path.

param: string path of login page should login is required

doAuthentication($sender,$param)   X-Ref
Performs authentication.
This is the event handler attached to application's Authentication event.
Do not call this method directly.

param: mixed sender of the Authentication event
param: mixed event parameter

doAuthorization($sender,$param)   X-Ref
Performs authorization.
This is the event handler attached to application's Authorization event.
Do not call this method directly.

param: mixed sender of the Authorization event
param: mixed event parameter

leave($sender,$param)   X-Ref
Performs login redirect if authorization fails.
This is the event handler attached to application's EndRequest event.
Do not call this method directly.

param: mixed sender of the event
param: mixed event parameter

getReturnUrl()   X-Ref

return: string URL that the browser should be redirected to when login succeeds.

onAuthenticate($param)   X-Ref
Performs the real authentication work.
An OnAuthenticate event will be raised if there is any handler attached to it.
If the application already has a non-null user, it will return without further authentication.
Otherwise, user information will be restored from session data.

param: mixed parameter to be passed to OnAuthenticate event

onAuthorize($param)   X-Ref
Performs the real authorization work.
Authorization rules obtained from the application will be used to check
if a user is allowed. If authorization fails, the response status code
will be set as 401 and the application terminates.

param: mixed parameter to be passed to OnAuthorize event

generateUserSessionKey()   X-Ref

return: string a key used to store user information in session

updateSessionUser($user)   X-Ref
Updates the user data stored in session.

param: IUser user object

login($username,$password)   X-Ref
Logs in a user with username and password.
The username and password will be used to validate if login is successful.
If yes, a user object will be created for the application.

param: string username
param: string password
return: boolean if login is successful

logout()   X-Ref
Logs out a user.
User session will be destroyed after this method is called.




Généré le : Sun Feb 25 21:07:04 2007 par Balluche grâce à PHPXref 0.7