ekapusta/oauth2-esia-bundle

为 ekapusta/oauth2-esia 配置和 symfony 服务。

安装次数: 2,762

依赖项: 0

建议者: 0

安全: 0

星标: 7

关注者: 5

分支: 2

开放问题: 0

类型:symfony-bundle

2.0 2020-09-29 18:58 UTC

This package is auto-updated.

Last update: 2024-08-29 04:31:38 UTC


README

Build Status Software License

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_idredirect_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.providerekapusta_oauth2_esia.service。当您只需授权用户并获取信息时,则可以使用 ekapusta_oauth2_esia.service。在其他情况下使用 ekapusta_oauth2_esia.provider。第二个只是第一个的简化外观。