菜谱项目

jwt.php 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. <?php
  2. /*
  3. * This file is part of jwt-auth.
  4. *
  5. * (c) Sean Tymon <tymon148@gmail.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. return [
  11. /*
  12. |--------------------------------------------------------------------------
  13. | JWT Authentication Secret
  14. |--------------------------------------------------------------------------
  15. |
  16. | Don't forget to set this, as it will be used to sign your tokens.
  17. | A helper command is provided for this: `php artisan jwt:generate`
  18. |
  19. */
  20. 'secret' => env('JWT_SECRET', 'nojw6nGfc59YUPJxOaWtJBR3J6Kh6wov'),
  21. /*
  22. |--------------------------------------------------------------------------
  23. | JWT time to live
  24. |--------------------------------------------------------------------------
  25. |
  26. | Specify the length of time (in minutes) that the token will be valid for.
  27. | Defaults to 1 hour
  28. |
  29. */
  30. 'ttl' => 60,
  31. /*
  32. |--------------------------------------------------------------------------
  33. | Refresh time to live
  34. |--------------------------------------------------------------------------
  35. |
  36. | Specify the length of time (in minutes) that the token can be refreshed
  37. | within. I.E. The user can refresh their token within a 2 week window of
  38. | the original token being created until they must re-authenticate.
  39. | Defaults to 2 weeks
  40. |
  41. */
  42. 'refresh_ttl' => 20160,
  43. /*
  44. |--------------------------------------------------------------------------
  45. | JWT hashing algorithm
  46. |--------------------------------------------------------------------------
  47. |
  48. | Specify the hashing algorithm that will be used to sign the token.
  49. |
  50. | See here: https://github.com/namshi/jose/tree/2.2.0/src/Namshi/JOSE/Signer
  51. | for possible values
  52. |
  53. */
  54. 'algo' => 'HS256',
  55. /*
  56. |--------------------------------------------------------------------------
  57. | User Model namespace
  58. |--------------------------------------------------------------------------
  59. |
  60. | Specify the full namespace to your User model.
  61. | e.g. 'Acme\Entities\User'
  62. |
  63. */
  64. 'user' => 'App\User',
  65. /*
  66. |--------------------------------------------------------------------------
  67. | User identifier
  68. |--------------------------------------------------------------------------
  69. |
  70. | Specify a unique property of the user that will be added as the 'sub'
  71. | claim of the token payload.
  72. |
  73. */
  74. 'identifier' => 'id',
  75. /*
  76. |--------------------------------------------------------------------------
  77. | Required Claims
  78. |--------------------------------------------------------------------------
  79. |
  80. | Specify the required claims that must exist in any token.
  81. | A TokenInvalidException will be thrown if any of these claims are not
  82. | present in the payload.
  83. |
  84. */
  85. 'required_claims' => ['iss', 'iat', 'exp', 'nbf', 'sub', 'jti'],
  86. /*
  87. |--------------------------------------------------------------------------
  88. | Blacklist Enabled
  89. |--------------------------------------------------------------------------
  90. |
  91. | In order to invalidate tokens, you must have the blacklist enabled.
  92. | If you do not want or need this functionality, then set this to false.
  93. |
  94. */
  95. 'blacklist_enabled' => env('JWT_BLACKLIST_ENABLED', true),
  96. /*
  97. |--------------------------------------------------------------------------
  98. | Providers
  99. |--------------------------------------------------------------------------
  100. |
  101. | Specify the various providers used throughout the package.
  102. |
  103. */
  104. 'providers' => [
  105. /*
  106. |--------------------------------------------------------------------------
  107. | User Provider
  108. |--------------------------------------------------------------------------
  109. |
  110. | Specify the provider that is used to find the user based
  111. | on the subject claim
  112. |
  113. */
  114. 'user' => 'Tymon\JWTAuth\Providers\User\EloquentUserAdapter',
  115. /*
  116. |--------------------------------------------------------------------------
  117. | JWT Provider
  118. |--------------------------------------------------------------------------
  119. |
  120. | Specify the provider that is used to create and decode the tokens.
  121. |
  122. */
  123. 'jwt' => 'Tymon\JWTAuth\Providers\JWT\NamshiAdapter',
  124. /*
  125. |--------------------------------------------------------------------------
  126. | Authentication Provider
  127. |--------------------------------------------------------------------------
  128. |
  129. | Specify the provider that is used to authenticate users.
  130. |
  131. */
  132. 'auth' => 'Tymon\JWTAuth\Providers\Auth\IlluminateAuthAdapter',
  133. /*
  134. |--------------------------------------------------------------------------
  135. | Storage Provider
  136. |--------------------------------------------------------------------------
  137. |
  138. | Specify the provider that is used to store tokens in the blacklist
  139. |
  140. */
  141. 'storage' => 'Tymon\JWTAuth\Providers\Storage\IlluminateCacheAdapter',
  142. ],
  143. ];