auth.php 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. return [
  11. /*
  12. |--------------------------------------------------------------------------
  13. | Authentication Defaults
  14. |--------------------------------------------------------------------------
  15. |
  16. | This option controls the default authentication "guard" and password
  17. | reset options for your application. You may change these defaults
  18. | as required, but they're a perfect start for most applications.
  19. |
  20. */
  21. 'defaults' => [
  22. 'guard' => env('AUTH_GUARD', 'api'),
  23. ],
  24. /*
  25. |--------------------------------------------------------------------------
  26. | Authentication Guards
  27. |--------------------------------------------------------------------------
  28. |
  29. | Next, you may define every authentication guard for your application.
  30. | Of course, a great default configuration has been defined for you
  31. | here which uses session storage and the Eloquent user provider.
  32. |
  33. | All authentication drivers have a user provider. This defines how the
  34. | users are actually retrieved out of your database or other storage
  35. | mechanisms used by this application to persist your user's data.
  36. |
  37. | Supported: "token"
  38. |
  39. */
  40. 'guards' => [
  41. 'api' => [
  42. 'driver' => 'jwt',
  43. 'provider' => 'users', // 与下面的 providers 中的 users 是对应的
  44. ],
  45. 'admins' => [
  46. 'driver' => 'jwt',
  47. 'provider' => 'admins', // 与下面的 providers 中的 users 是对应的
  48. ],
  49. ],
  50. /*
  51. |--------------------------------------------------------------------------
  52. | User Providers
  53. |--------------------------------------------------------------------------
  54. |
  55. | All authentication drivers have a user provider. This defines how the
  56. | users are actually retrieved out of your database or other storage
  57. | mechanisms used by this application to persist your user's data.
  58. |
  59. | If you have multiple user tables or models you may configure multiple
  60. | sources which represent each model / table. These sources may then
  61. | be assigned to any extra authentication guards you have defined.
  62. |
  63. | Supported: "database", "eloquent"
  64. |
  65. */
  66. 'providers' => [
  67. 'admins' => [
  68. 'driver' => 'custom',
  69. 'model' => \App\Repositories\Models\Base\Admin::class,
  70. ],
  71. 'users' => [
  72. 'driver' => 'custom',
  73. 'model' => \App\Repositories\Models\User\User::class,
  74. ],
  75. ],
  76. /*
  77. |--------------------------------------------------------------------------
  78. | Resetting Passwords
  79. |--------------------------------------------------------------------------
  80. |
  81. | Here you may set the options for resetting passwords including the view
  82. | that is your password reset e-mail. You may also set the name of the
  83. | table that maintains all of the reset tokens for your application.
  84. |
  85. | You may specify multiple password reset configurations if you have more
  86. | than one user table or model in the application and you want to have
  87. | separate password reset settings based on the specific user types.
  88. |
  89. | The expire time is the number of minutes that the reset token should be
  90. | considered valid. This security feature keeps tokens short-lived so
  91. | they have less time to be guessed. You may change this as needed.
  92. |
  93. */
  94. 'passwords' => [
  95. ],
  96. ];