codybuell/laravault-auth

用于验证 Laravel 与 Hashicorp 的 Vault 的包。

安装次数: 1

依赖者: 0

建议者: 0

安全: 0

星标: 0

关注者: 3

分支: 1

开放问题: 0

类型:laravel-package

dev-master 2017-08-18 19:25 UTC

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 构建 и 测试。

安装

  1. 手动或使用 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"
      
  2. 将提供者添加到 config/app.php 中 providers 数组

     CodyBuell\LaravaultAuth\LaravaultAuthServiceProvider::class,
    
  3. 发布配置并配置 config/laravault-auth.php

     php artisan vendor:publish
    
  4. config/auth.php 中将 'vault' 设置为您的身份验证提供者

     'providers' => [
         'users' => [
             'driver' => 'vault',
         ],
     ]
    
  5. 将身份验证设置为使用用户名而不是电子邮件。在 app/Http/Controllers/Auth/LoginController.php 中添加

     /**
      * Use usernames instead of emails.
      */
     public function username() {
       return 'username';
     }
    

使用方法

访问 Vault 客户端令牌

访问用户属性

待办事项

  • 编写测试
  • 添加选项以不将 Laravel 会话长度绑定到 vault ttl