正如标题所暗示的那样,是否可以在没有DB的情况下进行身份验证(而使用用户提供程序)?
我看到过大约how to authenticate without password篇帖子,但如果没有DB篇,还能进行身份验证吗?
这就是我一直在努力实现的...
- 请用户提交PIN
- Compare the PIN with a value within .env
- If the PIN is correct, authenticate the user
It seems to be possible to do authenticate without a traditional RDBMS by introducing a user provider.
However, the doc doesn't seem to describe how the user provider should look like.
Here are snippets of my code (well, I simply mimicked the doc)...
class AuthServiceProvider extends ServiceProvider {
public function boot()
{
$this->registerPolicies();
Auth::provider('myUser', function ($app, array $config) {
// Return an instance of Illuminate\Contracts\Auth\UserProvider...
return new MyUserProvider($app->make('myUser'));
});
}
}
auth.php
年后...
'providers' => [
'users' => [
'driver' => 'myUser',
],
],
Now, I have no clue as to how to proceed.
So, I'd like to know...
user provider
人应该是什么样子如果有可能首先用
env()
来验证用户身份
Any advice will be appreciated.