承接 groupepsih/oauth2-prosanteconnect 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

groupepsih/oauth2-prosanteconnect

最新稳定版本:1.0.2

Composer 安装命令:

composer require groupepsih/oauth2-prosanteconnect

包简介

Pro Sante Connect / ANS OAuth 2.0 Client Provider for The PHP League OAuth2-Client

README 文档

README

This package provides ANS / Pro Sante Connect OAuth 2.0 support for the PHP League's OAuth 2.0 Client.

Requirements

The following versions of PHP are tested:

  • PHP 8.1

Some other versions may work, but are not tested at this time.

To use this package, it will be necessary to have an ANS Pro Sante Connect client ID and client secret. These are referred to as {psc-client-id} and {psc-client-secret} in the documentation.

Installation

To install, use composer:

composer require groupepsig/oauth2-prosanteconnect

Usage w/Symfony 6.x

To use this with Symfony 6.x you have to add a client class in your application, something around the lines of:

namespace App\OAuth2\Client\Provider;

use KnpU\OAuth2ClientBundle\Client\OAuth2Client;
use League\OAuth2\Client\Token\AccessToken;
use GroupePSIH\OAuth2\Client\Provider\ProSanteConnectResourceOwner;

class ProSanteConnectClient extends OAuth2Client
{
    public function fetchUserFromToken(AccessToken $accessToken): ProSanteConnectResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface
    {
        return parent::fetchUserFromToken($accessToken);
    }

    public function fetchUser(): ProSanteConnectResourceOwner|\League\OAuth2\Client\Provider\ResourceOwnerInterface
    {
        return parent::fetchUser();
    }
}

Use the knpuniversity/oauth2-client-bundle And make the appropriate modifications in the config/packages/knpu_oauth2_client.yaml:

knpu_oauth2_client:
    http_client_options:
        proxy: false
        timeout: 5
    clients:
        prosc:
            type: generic
            provider_class: App\OAuth2\Client\Provider\ProSanteConnect
            client_id: '%env(PROSC_CLIENTID)%'
            client_secret: '%env(PROSC_SECRET)%'
            redirect_route: 'prosc_oauth_check'
            redirect_params: {}
            provider_options: {'dev': true}

and security.yaml:

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            lazy: true
            form_login:
                login_path: prosc_oauth_login
                # for Gitlab (test)
                # login_path: gitlab_oauth_login
            guard:
                authenticators:
                    - App\Security\ProSCAuthenticator
                    # for Gitlab (test)
                    # - App\Security\GitlabAuthenticator

ProSCAuthenticator being a class extending SocialAuthenticator with your business logic.

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-10-28

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固