void __construct(
mixed
$isValidCallback, [mixed
$getDataCallback = null]
)
|
|
Constructor
Creates authentication object using passed validation callback and optional getData callback (for retrieving user data).
Parameters:
|
mixed |
$isValidCallback: |
Authentication callback |
|
mixed |
$getDataCallback: |
Optional callback for retrieving user data |
API Tags:
Information Tags:
| Throws: | Phly_Auth_Exception |
mixed config(
string
$key, mixed
$value
)
|
|
Configuration
Allows storing/retrieving authentication options.
Passing no values returns the entire $_config.
Passing a single string value returns the value associated with that key in $_config.
Passing two values associates the second value with the key specified in the first in $_config.
If all else fails, returns null.
Parameters:
|
string |
$key: |
Optional; configuration key |
|
mixed |
$value: |
Optional; value to store in $key |
API Tags:
false|array getSessionData(
)
|
|
Get session data from an authentication session
Returns all session data stored in the sessionData array of the auth session.
To access individual values from the array, access them as class properties.
API Tags:
Checks whether a user has authenticated.
First checks to see if the user exists in the session; then attempts to log a person in.
API Tags:
Logout a user
Logs out a user by unsetting the authentication session.
API Tags:
Starts session, if not already done, updating auth session timestamp if present.
API Tags:
Attempt to login a user
Attempts to login a user via $_POST (or $_GET if 'use_get' config value is set to true).
Uses the config values:
- form_username: username element of form
- form_password: password element of form
- form_submit: name of submit button of form (or any other key that
should be utilized)Then applies 'password_hash' config callback to the password, and sends username and password to isValid() method of container.
API Tags:
Information Tags:
| Throws: | Phly_Auth_Exception if unable to populate session data |
mixed __get(
string
$key
)
|
|
Retrieve a value from the session auth array
Attempts to retrieve a value from the session auth array or the sessionData array of the session auth array. If the value exists, it is returned; otherwise, false is returned.
Parameters:
API Tags:
boolean __set(
string
$key, mixed
$value
)
|
|
Set data in the sessionData array of the auth session
Parameters:
|
string |
$key: |
|
|
mixed |
$value: |
|
API Tags: