session.php 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Lithium: the most rad php framework
  4. *
  5. * @copyright Copyright 2013, Union of RAD (http://union-of-rad.org)
  6. * @license http://opensource.org/licenses/bsd-license.php The BSD License
  7. */
  8. /**
  9. * This configures your session storage. The Cookie storage adapter must be connected first, since
  10. * it intercepts any writes where the `'expires'` key is set in the options array.
  11. * The default name is based on the lithium app path. Remember, if your app is numeric or has
  12. * special characters you might want to use Inflector::slug() or set this manually.
  13. */
  14. use lithium\storage\Session;
  15. $name = basename(LITHIUM_APP_PATH);
  16. Session::config(array(
  17. // 'cookie' => array('adapter' => 'Cookie', 'name' => $name),
  18. 'default' => array('adapter' => 'Php', 'session.name' => $name)
  19. ));
  20. /**
  21. * Uncomment the lines below to enable forms-based authentication. This configuration will attempt
  22. * to authenticate users against a `Users` model. In a controller, run
  23. * `Auth::check('default', $this->request)` to authenticate a user. This will check the POST data of
  24. * the request (`lithium\action\Request::$data`) to see if the fields match the `'fields'` key of
  25. * the configuration below. If successful, it will write the data returned from `Users::first()` to
  26. * the session using the default session configuration.
  27. *
  28. * Once the session data is written, you can call `Auth::check('default')` to check authentication
  29. * status or retrieve the user's data from the session. Call `Auth::clear('default')` to remove the
  30. * user's authentication details from the session. This effectively logs a user out of the system.
  31. * To modify the form input that the adapter accepts, or how the configured model is queried, or how
  32. * the data is stored in the session, see the `Form` adapter API or the `Auth` API, respectively.
  33. *
  34. * @see lithium\security\auth\adapter\Form
  35. * @see lithium\action\Request::$data
  36. * @see lithium\security\Auth
  37. */
  38. // use lithium\security\Auth;
  39. // Auth::config(array(
  40. // 'default' => array(
  41. // 'adapter' => 'Form',
  42. // 'model' => 'Users',
  43. // 'fields' => array('username', 'password')
  44. // )
  45. // ));
  46. ?>