codybuell / laravault-auth
用于验证 Laravel 与 Hashicorp 的 Vault 的包。
dev-master
2017-08-18 19:25 UTC
Requires
- mashape/unirest-php: ^3.0
This package is not auto-updated.
Last update: 2024-09-29 04:36:47 UTC
README
Laravel 包,用于将 Hashicorp 的 Vault 作为身份验证提供者。对 Vault 实例进行用户验证,将用户信息存储在会话中,并在 vault ttl 过期时处理关闭 Laravel 会话。使用 Laravel 5.4 构建 и 测试。
安装
-
手动或使用 composer 安装 LaravaultAuth 包
-
Composer
composer require codybuell/laravault-auth -
手动
git clone https://github.com/codybuell/laravault-auth.git vendor/codybuell/laravault-auth # edit composer.json, under autoload -> psr-4 append: "CodyBuell\\LaravaultAuth\\": "vendor/codybuell/laravault-auth/src"
-
-
将提供者添加到
config/app.php中 providers 数组CodyBuell\LaravaultAuth\LaravaultAuthServiceProvider::class, -
发布配置并配置
config/laravault-auth.phpphp artisan vendor:publish -
在
config/auth.php中将 'vault' 设置为您的身份验证提供者'providers' => [ 'users' => [ 'driver' => 'vault', ], ] -
将身份验证设置为使用用户名而不是电子邮件。在
app/Http/Controllers/Auth/LoginController.php中添加/** * Use usernames instead of emails. */ public function username() { return 'username'; }
使用方法
访问 Vault 客户端令牌
访问用户属性
待办事项
- 编写测试
- 添加选项以不将 Laravel 会话长度绑定到 vault ttl