goms / cognito
AWS Cognito 提供商用于 Laravel 认证
1.0.0
2020-07-21 12:47 UTC
Requires
- php: ^7.3
- ext-gmp: *
- ext-json: *
- illuminate/contracts: ^7.1
- web-token/jwt-checker: ^2.0
- web-token/jwt-core: ^2.0
- web-token/jwt-signature: ^2.0
- web-token/jwt-signature-algorithm-rsa: ^2.0
Requires (Dev)
- doctrine/coding-standard: ^6.0
- illuminate/cache: ~7.1
- illuminate/config: ~7.1
- illuminate/container: ~7.1
- phpstan/phpstan: ^0.12.4
- phpunit/phpunit: ^9.0
- web-token/jwt-easy: ~2.0
This package is auto-updated.
Last update: 2024-09-21 22:20:13 UTC
README
Laravel Cognito 提供商 🔑
这个库为 Laravel 提供了 CognitoUserProvider。
安装
composer require customergauge/laravel-cognito-provider
用法
认证配置
在 auth.php
文件中,添加以下设置
默认守卫
'defaults' => [ 'guard' => 'cognito-token', 'passwords' => 'users', ],
新的守卫配置
'guards' => [ 'cognito-token' => [ 'driver' => 'token', 'provider' => 'cognito-provider', 'storage_key' => 'cognito_token', 'hash' => false, ], ],
用户提供者配置
'providers' => [ 'cognito-provider' => [ 'driver' => \CustomerGauge\Cognito\CognitoUserProvider::class, ], ],
Cognito 环境变量
/* |-------------------------------------------------------------------------- | Cognito Custom Configuration |-------------------------------------------------------------------------- | | The following configuration is not part of standard Laravel application. | We use it to configure the CognitoUserProvider process so that we can | properly validate the JWT token provided by AWS Cognito. | */ 'cognito' => [ 'pool' => env('AWS_COGNITO_USER_POOL_ID'), 'region' => env('AWS_COGNITO_USER_POOL_REGION'), ],
认证中间件
在 App\Http\Kernel
中配置 auth
中间件为 'auth:cognito-token'