zeroweb/azuresso

Azure SSO Integration Package

2.2 2023-09-01 13:33 UTC

This package is auto-updated.

Last update: 2024-04-30 00:44:09 UTC


README

Quickly integrate Azure Single Sign On

Installation

Install the latest version with

$ composer require zeroweb/azuresso

Basic Usage

<?php

use Symfony\Component\HttpFoundation\Request;
use ZeroWeb\AzureSSO;
$request = Request::createFromGlobals();

## $azureCreds = array of the credenetials

$config = [
     'clientId' => 'client id',
    'clientSecret' => 'client secret',
    'tenantId' => 'tenant id',
    'scope' => 'User.Read GroupMember.Read.All',
    'returnUrl' => 'https://localhost/sso',
    'returnGroups' => true, // set false to not return the user groups. If set to true, requires GroupMemeber.Read.All scope
];

$sso = new AzureSSO($config, $request);
try {
    $sso->authenticate(); 
    // The user is authenticated at this point and the session contains the auth data.
} catch (Exception $e) {
    echo ("There was a problem with authentication." . $e->getMessage());
}