如何更改 Laravel 基本身份验证中间件的驱动程序?
How can you change the driver for the Laravel basic authentication middleware?
我想使用 Laravel 中的基本身份验证中间件,但不使用它背后的数据库。
By default, the auth.basic middleware will use the email column on the
user record as the "username".
有没有办法将它更改为文件系统或其他东西,这样我就可以简单地在文件中的某个地方添加用户名和密码。我只需要安全性,我的数据在 Elasticsearch 服务器中,所以我不需要 Laravel.
后面的 MySQL 数据库
https://laravel.com/docs/5.4/authentication#http-basic-authentication
只需创建一个新的中间件。参见 https://laravel.com/docs/5.4/middleware#registering-middleware
在您的自定义中间件中,您可以使用自己的自定义身份验证 类,其中包括文件 io.
然后,将经过身份验证的路由放入该自定义中间件路由组中。
我想使用 Laravel 中的基本身份验证中间件,但不使用它背后的数据库。
By default, the auth.basic middleware will use the email column on the user record as the "username".
有没有办法将它更改为文件系统或其他东西,这样我就可以简单地在文件中的某个地方添加用户名和密码。我只需要安全性,我的数据在 Elasticsearch 服务器中,所以我不需要 Laravel.
后面的 MySQL 数据库https://laravel.com/docs/5.4/authentication#http-basic-authentication
只需创建一个新的中间件。参见 https://laravel.com/docs/5.4/middleware#registering-middleware
在您的自定义中间件中,您可以使用自己的自定义身份验证 类,其中包括文件 io.
然后,将经过身份验证的路由放入该自定义中间件路由组中。