定制 wishtreehkumar/azureadsso 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

wishtreehkumar/azureadsso

Composer 安装命令:

composer require wishtreehkumar/azureadsso

包简介

Azure Active Directory SSO Login flow

README 文档

README

This package will help you easily implement the Azure Active Directory SSO Login and Graph API Access.

Installation Steps

composer require wishtreehkumar/azureadsso

To edit config file

php artisan vendor:publish --provider="Wishtreehkumar\Azureadsso\ServiceProvider" --tag="config"

How to use

Set .env

AZURE_AD_CLIENT_SECRET=--
AZURE_AD_CLIENT_ID=--
AZURE_AD_TENANT_ID=--

AZURE_AD_TENANT_NAME=--
AZURE_AD_POLICY_NAME=--

AZURE_AD_CALLBACK_URI=--

Generate Password

use Wishtreehkumar\Azureadsso\Facades\AzureAD;

$password = AzureAD::generatePassword();

Generate Login URL

- There are two type of Azure AD:
    - b2c
    - normal

$url = AzureAD::generateLoginUrl('b2c');

return redirect()->away($url);

Validate id_token in callback url

$azureAd = AzureAD::construct($request->id_token, 'b2c');

if ($azureAd->isAuthenticated()) {
    $azurePayload = $azureAd->getPayload();
}

Call Graph API

$grapApi = AzureAD::graphApi($method, $endPoint, $body);

EG: For create B2C User:

$dataBody = [
    'accountEnabled' => true,
    'displayName' => "Your Company",
    'identities' => [
        [
            'signInType' => 'emailAddress',
            'issuer' => 'your_tenet.onmicrosoft.com',
            'issuerAssignedId' => 'your_email@example.com',
        ],
    ],
    'passwordProfile' => [
        'password' => $password,
        'forceChangePasswordNextSignIn' => false,
    ],
    'passwordPolicies' => 'DisablePasswordExpiration',
];

$grapApi = AzureAD::graphApi('post', 'users', $dataBody);

dd($grapApi->object());

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-09-01