pod-point / laravel-cognito-auth
此包已被弃用,不再维护。未建议替代包。
Laravel 的认证驱动器
v0.1.2
2017-05-22 14:38 UTC
Requires
- php: >=5.5.9
- aws/aws-sdk-php: ^3.27
- illuminate/auth: 5.*
- illuminate/config: 5.*
- illuminate/support: 5.*
Requires (Dev)
- mockery/mockery: 0.9.*
- phpunit/phpunit: ~5.7
This package is auto-updated.
Last update: 2023-02-24 01:19:28 UTC
README
AWS Cognito Auth 驱动器,适用于 Laravel
安装
将以下行添加到您的 composer.json
文件中
"pod-point/laravel-cognito-auth": "^0.1"
然后在 config/app.php
中添加服务提供者
PodPoint\LaravelCognitoAuth\Providers\CognitoAuthServiceProvider::class
更新 auth.php
中的驱动器
'driver' => 'cognito',
发布配置文件
php artisan vendor:publish --provider="PodPoint\LaravelCognitoAuth\Providers\CognitoAuthServiceProvider"
将以下内容添加到您的 .env
文件中
AWS_KEY=
AWS_SECRET=
AWS_REGION=
AWS_COGNITO_CLIENT_ID=
AWS_COGNITO_CLIENT_SECRET=
AWS_COGNITO_USER_POOL_ID=
使用方法
您可以使用提供的 Laravel Auth 风格特性,这些特性为标准的 Laravel Auth 工作流程提供模板
PodPoint\LaravelCognitoAuth\Auth\AuthenticatesUsers
PodPoint\LaravelCognitoAuth\Auth\RegistersUsers
PodPoint\LaravelCognitoAuth\Auth\ResetsPasswords
PodPoint\LaravelCognitoAuth\Auth\SendsPasswordResetEmails
或者您可以直接使用 CognitoClient
。
注册流程
register($username, $password, array $attributes = [])
这将使用指定的用户名/密码注册用户,并将他们的电子邮件地址设置为已验证。用户将立即能够使用提供的凭据登录。
inviteUser($username, array $attributes = [])
这将使用指定的电子邮件地址注册用户,并将他们标记为 NEW_PASSWORD_REQUIRED
。他们还将收到一封电子邮件,要求他们通过现有的密码重置工作流程重置密码。一旦设置了此密码,用户将能够登录。