checkAuth()
Returns true if there is a session with valid authentication. boolean checkAuth()
getAuth()
Returns true if the current user is logged in. boolean getAuth()
getAuthData()
Returns the authentication data for the given field. If nothing is passed to the function, it will return everything that it knows about the current session.
mixed getAuthData([string $name = null])
Parameter Type Description
$name string The name of the field that contains the authentication data.
getPostPasswordField()
Returns the name of the field used for the password.
string getPostPasswordField()
getPostUsernameField()
Returns the name of the field used for the username.
string getPostUsernameField()
getStatus()
Returns the status of the current user.
string getStatus()
getUsername()
Returns the name of the current user.
string getUsername()
listUsers()
Returns an array containing the names of all the users in the current storage container.
array listUsers()
logout()
First calls the logout callback method, if one is defined, then sets the username and password to empty strings and sets the session to null.
void logout()
removeUser()
Deletes the given user from the storage container and returns true if the function is successful. If the user wasn’t deleted, the function returns AUTH_METHOD_NOT_SUPPORTED.
mixed removeUser(string $username)
Parameter Type Description
$username string The login name of the user to be removed.
sessionValidThru()
Returns the time in seconds until the session expires.
integer sessionValidThru()
setAdvancedSecurity()
If passed true, Auth begins to perform more advanced security checks, such as detecting IP address and user agent changes.
void setAdvancedSecurity([boolean $flag = true])
Join us next week as we continue this chapter on authentication!
This article is an excerpt from Chapter 2 of Foundations of Pear, reprinted with permission from Apress.