codybuell/laravault-auth
Laravel 5.4 auth provider that authenticates users against Hashicorp Vault. Stores user info in the Laravel session, tracks Vault TTL, and ends the Laravel session when the Vault token expires. Configurable as an auth driver via config/auth.php.
AuthManager to fetch user credentials from Vault (e.g., JWT, OAuth tokens).config() system to define Vault paths/roles.Cache or Queue systems..env backup).composer.json for constraints).curl and openssl (common in Laravel deployments).hashicorp/vault-php) must align with Vault server version.vault.token.refresh).| Risk | Mitigation | Severity |
|---|---|---|
| Vault Connectivity | Implement retries/circuit breakers (e.g., Laravel’s Retryable trait). |
High |
| Token Expiry | Use Laravel’s Queue for async token refresh with exponential backoff. |
Medium |
| Secrets Leakage | Validate Vault paths/roles in config; audit logs via Vault’s audit device. | Critical |
| Performance | Cache Vault responses (e.g., Cache::remember()) for non-volatile secrets. |
Low |
| Package Maturity | Low stars/activity → Review test coverage and issue tracker. | Medium |
.env if Vault is unavailable? What’s the priority (fail-open vs. fail-closed)?Log channel + ELK stack).Auth facade, Sanctum, Passport, or custom guards.config/vault.php (recommended structure).vault:refresh job).approle, token, or ldap (configured in config/vault.php).kv-v2, database, and transit engines.hashicorp/vault-php (e.g., Vault 1.10+ for newer APIs).vault_api_call_duration)..env, AWS Secrets Manager).approle for Laravel).// config/vault.php
'connections' => [
'default' => [
'url' => env('VAULT_ADDR'),
'token' => env('VAULT_TOKEN'), // or use 'approle' auth
'role' => env('VAULT_ROLE'),
],
],
AuthManager:
Auth::extend('vault', function ($app) {
return new VaultAuthServiceProvider($app);
});
.env DB credentials with Vault dynamic secrets.config/database.php to fetch credentials from Vault:
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST'),
'username' => fn() => Vault::secret('database/laravel/username'),
'password' => fn() => Vault::secret('database/laravel/password'),
],
],
composer.json).laravel/framework constraint: "^8.0|^9.0".hashicorp/vault-php version to match your Vault server (e.g., ^1.0 for Vault 1.x).env() overrides for VAULT_ADDR per environment.approle) and policies.composer require codybuell/laravault-auth.config/vault.php and service provider.UP endpoint.codybuell/laravault-auth for updates (low activity → manual review).hashicorp/vault-php alongside Vault server upgrades.VAULT_ROLE).stdout logging for API calls.Log::debug() to trace Vault interactions..env).How can I help you explore Laravel packages today?