customergauge/cognito 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

customergauge/cognito

最新稳定版本:2.0.0

Composer 安装命令:

composer require customergauge/cognito

包简介

AWS Cognito provider for Laravel Authentication

README 文档

README

Build Code Coverage Scrutinizer Code Quality

Laravel Cognito Provider ????

This library provides a CognitoUserProvider for Laravel.

Installation

composer require customergauge/cognito

Usage

Auth configuration

In the auth.php file, add the following settings:

Default Guard

 'defaults' => [ 'guard' => 'cognito-token', 'passwords' => 'users', ],

The new Guard configuration

 'guards' => [ 'cognito-token' => [ 'driver' => 'token', 'provider' => 'cognito-provider', 'storage_key' => 'cognito_token', 'hash' => false, ], ],

The User Provider configuration

 'providers' => [ 'cognito-provider' => [ 'driver' => \CustomerGauge\Cognito\CognitoUserProvider::class, ], ],

Cognito Environment Variables

 /*  |--------------------------------------------------------------------------  | 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'), ],

Auth Middleware

Configure the auth middleware at App\Http\Kernel with 'auth:cognito-token'

UserFactory

The last thing you'll need is to provide your own implementation of UserFactory and register it in a ServiceProvider.

final class CognitoUserFactory implements UserFactory { public function make(array $payload): ?Authenticatable { return new MyUserObject( $payload['username'], $payload['custom:my_custom_cognito_attribute'], ); } } 

In the provider:

$this->app->bind(CustomerGauge\Cognito\Contracts\UserFactory, App\Auth\CognitoUserFactory::class); 

统计信息

  • 总下载量: 43.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 22
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 22
  • Watchers: 7
  • Forks: 7
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固