wika-group/magento2-azure-ad-b2c-sso 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

wika-group/magento2-azure-ad-b2c-sso

Composer 安装命令:

composer require wika-group/magento2-azure-ad-b2c-sso

包简介

Module to add support for a login via Azure B2C

README 文档

README

Magento2 Module to add support for a login via Azure B2C.

This module can create a new Magento customer. It only sets the email, firstname and lastname.
If you want to fill other fields or store an address, you can use the events.

Important: Ensure that the email address is delivered in the Azure B2C response.

Table of contents

Installation

This Magento2 module can be installed using composer:
> composer require wika-group/magento2-azure-ad-b2c-sso

To remove it from the list of required packages use the following command:
> composer remove wika-group/magento2-azure-ad-b2c-sso

Updating to latest version

With the following command composer checks all packages in the composer.json for the latest version:
> composer update

If you only want to check this package for newer versions, you can use
> composer update wika-group/magento2-azure-ad-b2c-sso

Configuration

The configuration can be found in the admin backend under:
Stores -> Settings -> Configuration -> WIKA GROUP -> Azure B2C

If you do not want to use the provided button, you can disable it with the "Show button" setting.
To trigger the redirect to Azure for the login, call the route <your-domain>/azureb2c/login/authorize.
The response will be processed from the controller <your-domain>/azureb2c/login/callback.

image image

Autologin after registration in B2C

The first time a customer is registrating on the shop, the redirect after the registration takes them back to the shop.
But the shop doesn't know that the user is logged in. For this scenario, a GET parameter can be used to automatically redirect the user to the login again.
As the customer is already logged in in B2C, no input is required and a redirect will lead back to the shop, but now the customer will also be logged in to the shop.

image

Log out from Azure B2C

In the admin backend, you can enable logout from Azure B2C after the customer has logged out from Magento.
The observer for the customer_logout_after event will check if the logout from Azure B2C is enabled and will redirect to the logout URI from Azure B2C.

Call authorize with referer

By default the authorize controller will read the referer from the request header, store it in the session and redirect back to it in the callback controller.

You can pass a referer as GET parameter to customize the redirect:
<your-domain>/azureb2c/login/authorize?referer=<your-customer-referer-uri>

Events

customer_login

Observers for the event customer_login will be triggered if a customer uses Azure B2C to login.

customer_logout_after

The extension adds an additional event after the Session model executed the logout logic.
customer_logout is a default event triggered by the Session model before the logout is done.
customer_logout_after is triggered after the logout logic in the Session::logout function is executed.

azure_b2c_sso_[create|update]_customer_after

The extension triggers an event after a new customer was created and after a customer has been updated.

The event azure_b2c_sso_create_customer_after is triggered after this module created a new magento customer.

The event azure_b2c_sso_update_customer_after is triggered after this module updated a magento customer. The update also happends after a customer was created.

More details in official documentation

Usage of the events
<vendor_name>/<module_name>/etc/events.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <event name="azure_b2c_sso_create_customer_after">
        <observer name="<vendor_name>_sso_create_customer_after" instance="<vendor_name>\<module_name>\Observer\SsoCreatedCustomer"/>
    </event>
    <event name="azure_b2c_sso_update_customer_after">
        <observer name="<vendor_name>_sso_update_customer_after" instance="<vendor_name>\<module_name>\Observer\SsoUpdatedCustomer"/>
    </event>
</config>

<vendor_name><module_name>\Observer\SsoCreatedCustomer.php or <vendor_name><module_name>\Observer\SsoUpdatedCustomer.php

<?php

namespace <vendor_name>\<module_name>\Observer;

use Magento\Framework\Event\ObserverInterface;

class SsoCreatedCustomer implements ObserverInterface
{
    public function execute(\Magento\Framework\Event\Observer $observer)
    {
        $userData = $observer->getData('user_data');
        // Do some work with that data...
        $familyName = $userData['family_name'];
    }
}

wika-group/magento2-azure-ad-b2c-sso 适用场景与选型建议

wika-group/magento2-azure-ad-b2c-sso 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 125 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 05 月 21 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「Authentication」 「oauth」 「SSO」 「service provider」 「magento」 「single sign on」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 wika-group/magento2-azure-ad-b2c-sso 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 wika-group/magento2-azure-ad-b2c-sso 我们能提供哪些服务?
定制开发 / 二次开发

基于 wika-group/magento2-azure-ad-b2c-sso 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 2
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-05-21