Nexista_AuthThe Nexista Auth model is setup to allow user specified handlers to be used in order to provide whatever functionality is desired. A developer can setup their preferred authentication system and hook it into the nexista core.
Each gate can be setup in the sitemap to require a role. PHP Auth methods can also be used in scripts where a particular role is required, though with judicious use, the gate role is usually all that is needed.
Note that we us the term role which may imply a role-based system but since all of the inner user-group-role workings are handled by custom functions it does not matter to nexista what system is used. One could use a complex role based system or a simple one password / one user, as desired.
To use the Authentication system, the developer needs to implement a custom Login handler and optionally a Denied, Expired and Timeout handler in the prepend file. If a user is not logged in and encounters a role requirement, the login handler will be called. This handler is responsible for authenticating the user in whatever manner is preferred, then calling the Auth::registerUser() method with an array of allowed roles for this user.
If the session of a logged in user times out, expires or if the user encounters a role they do not have, the Timeout, Expired and Denied handler will be called respectively if setup. If the required handler is not setup, then it will default to the Login handler.
Located in /kernel/auth.php (line 45)
static registerDeniedHandler (line 498)
Registers a function to be called on auth denied access
This function will be called when a user, who is already logged in somehow, encounters a role beyond their access level. It might be used to offer the user to upgrade their level or present them with a denied screem.
static registerExpiredHandler (line 516)
Registers a function to be called on auth session expiry
This function will be called when the user's session expires. It might be used to reshow a login screen.
static registerLoginHandler (line 479)
Registers a function to be called on auth login
This function will be called when the user needs a specific role for an action and has not yet logged in. It could be used to show a login screen or somehow inform user that the action needs a special role.
static registerTimeoutHandler (line 532)
Registers a function to be called on auth session timeout This function will be called when the user's session times out from inactivity. It might be used to reshow a login screen.
static singleton (line 396)
Returns a class Nexista_singleton.
Constructor __construct (line 147)
Constructor - Inits session, config
checkStatus (line 431)
Checks a user's current state
This method will return the current user status as a constant:
getSessionData (line 364)
Returns user session data
If a variable name is passed, the value for it will be returned. If no name is passed, the entire array will be returned
registerUser (line 326)
Registers a user with valid roles
This methid is used by the login handle to register (login) the user with an array of allowed roles. These roles are called either in the sitemap tag as:
removeUser (line 412)
Delete all session information and logout the user.
requireRole (line 214)
Require that the user has a particular role
These roles are called using the sitemap tag as:
setSessionData (line 385)
Sets a user session data value
This method will set a variable value in the user session
setSessionName (line 347)
Sets the auth session name
Documentation generated on Tue, 11 Mar 2008 23:22:52 -0400 for Nexista 0.2.0