Inheritance diagram for AuthComponent:

Public Member Functions | |
| __authType ($auth=null) | |
| __setDefaults () | |
| action ($action= ':controller/:action') | |
| allow () | |
| deny () | |
| & | getModel ($name=null) |
| hashPasswords ($data) | |
| identify ($user=null, $conditions=null) | |
| initialize (&$controller) | |
| isAuthorized ($type=null, $object=null, $user=null) | |
| login ($data=null) | |
| logout () | |
| mapActions ($map=array()) | |
| password ($password) | |
| redirect ($url=null) | |
| shutdown (&$controller) | |
| startup (&$controller) | |
| user ($key=null) | |
| validate ($object, $user=null, $action=null) | |
Public Attributes | |
| $_loggedIn = false | |
| $_methods = array() | |
| $actionMap | |
| $actionPath = null | |
| $ajaxLogin = null | |
| $allowedActions = array() | |
| $authenticate = null | |
| $authError = null | |
| $authorize = false | |
| $autoRedirect = true | |
| $components = array('Session', 'RequestHandler') | |
| $data = array() | |
| $fields = array('username' => 'username', 'password' => 'password') | |
| $loginAction = null | |
| $loginError = null | |
| $loginRedirect = null | |
| $logoutRedirect = null | |
| $object = null | |
| $params = array() | |
| $sessionKey = null | |
| $userModel = 'User' | |
| $userScope = array() | |
Definition at line 39 of file auth.php.
| AuthComponent::__authType | ( | $ | auth = null |
) |
Get authorization type
| string | $auth Type of authorization |
Definition at line 539 of file auth.php.
References $object.
Referenced by isAuthorized(), and startup().
| AuthComponent::__setDefaults | ( | ) |
Attempts to introspect the correct values for object properties including $userModel and $sessionKey.
| object | $controller A reference to the instantiating controller object |
Definition at line 418 of file auth.php.
References __(), login(), Router::normalize(), password(), pluralize(), and underscore().
| AuthComponent::action | ( | $ | action = ':controller/:action' |
) |
Returns the path to the ACO node bound to a controller/action.
| string | $action Optional. The controller/action path to validate the user against. The current request action is used if none is specified. |
Definition at line 731 of file auth.php.
References camelize(), and params().
Referenced by isAuthorized(), and startup().
| AuthComponent::allow | ( | ) |
Takes a list of actions in the current controller for which authentication is not required, or no parameters to allow all actions.
| string | $action Controller action name | |
| string | $action Controller action name | |
| string | ... etc. |
| AuthComponent::deny | ( | ) |
Removes items from the list of allowed actions.
| string | $action Controller action name | |
| string | $action Controller action name | |
| string | ... etc. |
| & AuthComponent::getModel | ( | $ | name = null |
) |
Returns a reference to the model object specified, and attempts to load it if it is not found.
| string | $name Model name (defaults to AuthComponent::$userModel) |
Definition at line 746 of file auth.php.
References __(), and ClassRegistry::init().
Referenced by identify(), and isAuthorized().
| AuthComponent::hashPasswords | ( | $ | data | ) |
| AuthComponent::identify | ( | $ | user = null, |
|
| $ | conditions = null | |||
| ) |
Identifies a user based on specific criteria.
| mixed | $user Optional. The identity of the user to be validated. Uses the current user session if none specified. | |
| array | $conditions Optional. Additional conditions to a find. |
Definition at line 774 of file auth.php.
References $data, exists(), getModel(), password(), and user().
Referenced by login().
| AuthComponent::initialize | ( | &$ | controller | ) |
Initializes AuthComponent for use in the controller
| object | $controller A reference to the instantiating controller object |
Definition at line 231 of file auth.php.
References Debugger::checkSessionKey(), create(), App::import(), params(), Configure::read(), and read().
| AuthComponent::isAuthorized | ( | $ | type = null, |
|
| $ | object = null, |
|||
| $ | user = null | |||
| ) |
Determines whether the given user is authorized to perform an action. The type of authorization used is based on the value of AuthComponent::$authorize or the passed $type param.
Types: 'controller' will validate against Controller::isAuthorized() if controller instance is passed in $object 'actions' will validate Controller::action against an AclComponent::check() 'crud' will validate mapActions against an AclComponent::check() array('model'=> 'name'); will validate mapActions against model $name::isAuthorized(user, controller, mapAction) 'object' will validate Controller::action against object::isAuthorized(user, controller, action)
| string | $type Type of authorization | |
| mixed | $object object, model object, or model name | |
| mixed | $user The user to check the authorization of |
Definition at line 461 of file auth.php.
References $authorize, $object, __(), __authType(), a(), action(), getModel(), mapActions(), params(), user(), and valid().
Referenced by startup().
| AuthComponent::login | ( | $ | data = null |
) |
Manually log-in a user with the given parameter data. The $data provided can be any data structure used to identify a user in AuthComponent::identify(). If $data is empty or not specified, POST data from Controller::$data will be used automatically.
After (if) login is successful, the user record is written to the session key specified in AuthComponent::$sessionKey.
| mixed | $data User object |
Definition at line 625 of file auth.php.
References $data, __setDefaults(), and identify().
Referenced by __setDefaults(), and startup().
| AuthComponent::logout | ( | ) |
Logs a user out, and returns the login action to redirect to.
| mixed | $url Optional URL to redirect the user to after logout |
Definition at line 647 of file auth.php.
References __setDefaults(), and Router::normalize().
| AuthComponent::mapActions | ( | $ | map = array() |
) |
Maps action names to CRUD operations. Used for controller-based authentication.
| array | $map Actions to map |
Definition at line 601 of file auth.php.
References create(), and read().
Referenced by isAuthorized().
| AuthComponent::password | ( | $ | password | ) |
Hash a password with the application's salt value (as defined with Configure::write('Security.salt');
| string | $password Password to hash |
Definition at line 866 of file auth.php.
References Security::hash().
Referenced by __setDefaults(), hashPasswords(), identify(), and startup().
| AuthComponent::redirect | ( | $ | url = null |
) |
If no parameter is passed, gets the authentication redirect URL.
| mixed | $url Optional URL to write as the login redirect URL. |
Definition at line 684 of file auth.php.
References $url, and Router::normalize().
Referenced by startup().
| AuthComponent::shutdown | ( | &$ | controller | ) |
| AuthComponent::startup | ( | &$ | controller | ) |
Main execution method. Handles redirecting of invalid users, and processing of login form data.
| object | $controller A reference to the instantiating controller object |
Definition at line 264 of file auth.php.
References $allowedActions, Controller::$components, $data, $loginAction, $object, $url, __(), __authType(), __setDefaults(), Object::_stop(), action(), env(), ext(), hashPasswords(), isAuthorized(), login(), name(), Router::normalize(), params(), password(), Router::queryString(), Configure::read(), redirect(), user(), and uses().
| AuthComponent::user | ( | $ | key = null |
) |
Get the current user from the session.
| string | $key field to retrive. Leave null to get entire User record |
Definition at line 661 of file auth.php.
References __setDefaults().
Referenced by identify(), isAuthorized(), startup(), and validate().
| AuthComponent::validate | ( | $ | object, | |
| $ | user = null, |
|||
| $ | action = null | |||
| ) |
Validates a user against an abstract object.
| mixed | $object The object to validate the user against. | |
| mixed | $user Optional. The identity of the user to be validated. Uses the current user session if none specified. For valid forms of identifying users, see AuthComponent::identify(). | |
| string | $action Optional. The action to validate against. |
| AuthComponent::$actionMap |
| AuthComponent::$allowedActions = array() |
| AuthComponent::$authorize = false |
| AuthComponent::$components = array('Session', 'RequestHandler') |
| AuthComponent::$data = array() |
Definition at line 209 of file auth.php.
Referenced by hashPasswords(), identify(), login(), and startup().
| AuthComponent::$fields = array('username' => 'username', 'password' => 'password') |
| AuthComponent::$loginAction = null |
| AuthComponent::$object = null |
Definition at line 157 of file auth.php.
Referenced by __authType(), isAuthorized(), startup(), and validate().
1.4.7