PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/vendor/laravel/framework/src/Illuminate/Auth/AuthManager.php

https://bitbucket.org/helfreire/tccwebservice
PHP | 105 lines | 42 code | 20 blank | 43 comment | 1 complexity | d11d9fd4607a0f7d3dfdb58477087f4e MD5 | raw file
  1. <?php namespace Illuminate\Auth;
  2. use Illuminate\Support\Manager;
  3. class AuthManager extends Manager {
  4. /**
  5. * Create a new driver instance.
  6. *
  7. * @param string $driver
  8. * @return mixed
  9. */
  10. protected function createDriver($driver)
  11. {
  12. $guard = parent::createDriver($driver);
  13. // When using the remember me functionality of the authentication services we
  14. // will need to be set the encryption instance of the guard, which allows
  15. // secure, encrypted cookie values to get generated for those cookies.
  16. $guard->setCookieJar($this->app['cookie']);
  17. $guard->setDispatcher($this->app['events']);
  18. return $guard->setRequest($this->app['request']);
  19. }
  20. /**
  21. * Call a custom driver creator.
  22. *
  23. * @param string $driver
  24. * @return mixed
  25. */
  26. protected function callCustomCreator($driver)
  27. {
  28. $custom = parent::callCustomCreator($driver);
  29. if ($custom instanceof Guard) return $custom;
  30. return new Guard($custom, $this->app['session']);
  31. }
  32. /**
  33. * Create an instance of the database driver.
  34. *
  35. * @return \Illuminate\Auth\Guard
  36. */
  37. protected function createDatabaseDriver()
  38. {
  39. $provider = $this->createDatabaseProvider();
  40. return new Guard($provider, $this->app['session']);
  41. }
  42. /**
  43. * Create an instance of the database user provider.
  44. *
  45. * @return \Illuminate\Auth\DatabaseUserProvider
  46. */
  47. protected function createDatabaseProvider()
  48. {
  49. $connection = $this->app['db']->connection();
  50. // When using the basic database user provider, we need to inject the table we
  51. // want to use, since this is not an Eloquent model we will have no way to
  52. // know without telling the provider, so we'll inject the config value.
  53. $table = $this->app['config']['auth.table'];
  54. return new DatabaseUserProvider($connection, $this->app['hash'], $table);
  55. }
  56. /**
  57. * Create an instance of the Eloquent driver.
  58. *
  59. * @return \Illuminate\Auth\Guard
  60. */
  61. public function createEloquentDriver()
  62. {
  63. $provider = $this->createEloquentProvider();
  64. return new Guard($provider, $this->app['session']);
  65. }
  66. /**
  67. * Create an instance of the Eloquent user provider.
  68. *
  69. * @return \Illuminate\Auth\EloquentUserProvider
  70. */
  71. protected function createEloquentProvider()
  72. {
  73. $model = $this->app['config']['auth.model'];
  74. return new EloquentUserProvider($this->app['hash'], $model);
  75. }
  76. /**
  77. * Get the default authentication driver name.
  78. *
  79. * @return string
  80. */
  81. protected function getDefaultDriver()
  82. {
  83. return $this->app['config']['auth.driver'];
  84. }
  85. }