wishtreehkumar/azureadsso is a Laravel package for azure active directory sso login flow.
It currently has 0 GitHub stars and 3 downloads on Packagist.
Install it with composer require wishtreehkumar/azureadsso.
Discover more Laravel packages by wishtreehkumar
or browse all Laravel packages to compare alternatives.
Last updated
This package will help you easily implement the Azure Active Directory SSO Login and Graph API Access.
composer require wishtreehkumar/azureadsso
php artisan vendor:publish --provider="Wishtreehkumar\Azureadsso\ServiceProvider" --tag="config"
AZURE_AD_CLIENT_SECRET=--
AZURE_AD_CLIENT_ID=--
AZURE_AD_TENANT_ID=--
AZURE_AD_TENANT_NAME=--
AZURE_AD_POLICY_NAME=--
AZURE_AD_CALLBACK_URI=--
use Wishtreehkumar\Azureadsso\Facades\AzureAD;
$password = AzureAD::generatePassword();
There are two type of Azure AD:
- b2c
- normal
$url = AzureAD::generateLoginUrl('b2c');
return redirect()->away($url);
$azureAd = AzureAD::construct($request->id_token, 'b2c');
if ($azureAd->isAuthenticated()) {
$azurePayload = $azureAd->getPayload();
}
$grapApi = AzureAD::graphApi($method, $endPoint, $body);
$dataBody = [
'accountEnabled' => true,
'displayName' => "Your Company",
'identities' => [
[
'signInType' => 'emailAddress',
'issuer' => 'your_tenet.onmicrosoft.com',
'issuerAssignedId' => '[email protected]',
],
],
'passwordProfile' => [
'password' => $password,
'forceChangePasswordNextSignIn' => false,
],
'passwordPolicies' => 'DisablePasswordExpiration',
];
$grapApi = AzureAD::graphApi('post', 'users', $dataBody);
dd($grapApi->object());