josecl / emulador-claveunica
智利政府ClaveÚnica服务的仿真器
v0.10.1
2022-08-17 15:56 UTC
Requires
- php: ^8.0
- ext-json: *
- illuminate/contracts: ^9.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.9
- nunomaduro/collision: ^6.0
- nunomaduro/larastan: ^2.0.1
- orchestra/testbench: ^7.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.2
- pestphp/pest-plugin-mock: ^1.0
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
This package is auto-updated.
Last update: 2024-09-29 06:14:52 UTC
README
本项目仿真智利政府ClaveÚnica服务的认证,旨在允许在尚未配置ClaveÚnica认证环境的开发系统中进行登录。
重要
仅实现登录所需的最小机制。本项目不允许验证应用程序是否满足OpenID和ClaveÚnica所需的所有安全机制。
要求
- Laravel 9
- php 8.0
安装
安装依赖
composer require josecl/emulador-claveunica
发布配置文件
php artisan vendor:publish --tag emulador-claveunica
添加所需的配置,至少需要配置以下内容
EMULADOR_CLAVEUNICA_ENABLEDEMULADOR_CLAVEUNICA_CLIENT_IDEMULADOR_CLAVEUNICA_CLIENT_SECRET
客户端配置
需要配置与ClaveÚnica认证的认证流路由。这些路由可以通过变量EMULADOR_CLAVEUNICA_PREFIX进行修改。
原始路由如下
- https://accounts.claveunica.gob.cl/openid/authorize
- https://accounts.claveunica.gob.cl/openid/token
- https://www.claveunica.gob.cl/openid/userinfo
需要配置应用程序以使用以下路由
- http://example.com/openid/authorize
- http://example.com/openid/token
- http://example.com/openid/userinfo
其中 'http://example.com' 是ClaveÚnica仿真器安装的URL。
与josecl/claveunica的集成
如果您使用josecl/claveunica客户端,请更新config/services.php文件中的附加参数,并根据前面的文档配置以下环境变量
'claveunica' => [ 'client_id' => env('CLAVEUNICA_CLIENT_ID'), 'client_secret' => env('CLAVEUNICA_CLIENT_SECRET'), 'redirect' => env('CLAVEUNICA_REDIRECT_URI') // Configura servicio emulador ClaveÚnica... 'auth_uri' => env('CLAVEUNICA_AUTH_URI', 'https://accounts.claveunica.gob.cl/openid/authorize'), 'token_uri' => env('CLAVEUNICA_TOKEN_URI', 'https://accounts.claveunica.gob.cl/openid/token'), 'user_uri' => env('CLAVEUNICA_USER_URI', 'https://www.claveunica.gob.cl/openid/userinfo'), ],
例如
CLAVEUNICA_AUTH_URI=https://:8080/openid/authorize CLAVEUNICA_TOKEN_URI=https://:8080/openid/token CLAVEUNICA_USER_URI=https://:8080/openid/userinfo