ekapusta / oauth2-esia-bundle
为 ekapusta/oauth2-esia 配置和 symfony 服务。
Requires
- php: ^5.6 || ^7.0
- ekapusta/oauth2-esia: ^1.4
- symfony/config: ^2.8 || ^3 || ^4
- symfony/dependency-injection: ^2.8 || ^3 || ^4
- symfony/http-kernel: ^2.8 || ^3 || ^4
Requires (Dev)
- g1a/composer-test-scenarios: ^3.2
- guzzlehttp/guzzle: ^6.3
- monolog/monolog: ^1.23
- phpunit/phpunit: ^5.7
- squizlabs/php_codesniffer: ^2.7
- symfony/framework-bundle: ^2.8 || ^3 || ^4
This package is auto-updated.
Last update: 2024-08-29 04:31:38 UTC
README
为 ekapusta/oauth2-esia 提供配置和 symfony 服务。
安装
composer require ekapusta/oauth2-esia-bundle
在您的 kernell 中添加到其他 bundles
new Ekapusta\OAuth2EsiaBundle\EkapustaOAuth2EsiaBundle(),
配置
签名者
决定 使用哪个签名者 并在这些配置中设置这些参数
ekapusta_oauth2_esia.signer.class_name: Ekapusta\OAuth2Esia\Security\Signer\OpensslCli ekapusta_oauth2_esia.signer.certificate_path: /path/to/your/certificate/with/public-key-inside.cer ekapusta_oauth2_esia.signer.private_key_path: /path/to/your/certificates/private.key ekapusta_oauth2_esia.signer.private_key_password: 'some password' ekapusta_oauth2_esia.signer.tool_path: /path/to/your/openssl
提供者
您必须配置您的 client_id
和 redirect_uri
。
ekapusta_oauth2_esia.client_id: SOMESYSTEM ekapusta_oauth2_esia.redirect_uri: https://your-system.domain/auth/finish
如果需要更多授权用户的信息,则应配置作用域。请注意,您应仅在此处设置您有权限使用的范围。作用域的完整列表在 方法建议 中。
ekapusta_oauth2_esia.default_scopes: ['openid', 'fullname', '...']
测试模式
要使用测试模式,请将您的提供者配置为测试门户
ekapusta_oauth2_esia.remote_url: 'https://esia-portal1.test.gosuslugi.ru' ekapusta_oauth2_esia.remote_public_key: '%ekapusta_oauth2_esia.vendor.resources_path%/esia.test.public.key'
RS256 算法
默认情况下,我们现在使用 GOST 算法进行远程验证。要使用 RSA RS256
ekapusta_oauth2_esia.remote_public_key: '%ekapusta_oauth2_esia.vendor.resources_path%/esia.prod.public.key' ekapusta_oauth2_esia.remote_signer.algorytm: 'RS256'
日志记录
目前仅在传输级别使用记录器:注入到 guzzle http 客户端中。您可以通过 ekapusta_oauth2_esia.logger.class
参数配置自己的记录器类。或者只需在您的配置服务中重新定义 ekapusta_oauth2_esia.logger
。
用法
有两个 DI 服务可用:ekapusta_oauth2_esia.provider
和 ekapusta_oauth2_esia.service
。当您只需授权用户并获取信息时,则可以使用 ekapusta_oauth2_esia.service
。在其他情况下使用 ekapusta_oauth2_esia.provider
。第二个只是第一个的简化外观。