Composer package for the Azure AD Delta Sync flow.
If you are looking to use this in a Symfony or Drupal project you should use either:
- Symfony: itk-dev/azure-ad-delta-sync-symfony
- Drupal: itk-dev/azure-ad-delta-sync-drupal
To install this package directly run
composer require itk-dev/azure-ad-delta-syncTo start the flow one needs to call the
Controller run(HandlerInterface $handler) command.
Therefore, you must create your own handler that implements
HandlerInterface.
<?php
use ItkDev\AzureAdDeltaSync\Handler\HandlerInterface;
class SomeHandler implements HandlerInterface
{
public function collectUsersForDeletionList(): void
{
// Some start logic
}
public function removeUsersFromDeletionList(array $users): void
{
// Some user logic
}
public function commitDeletionList(): void
{
// Some commit logic
}
}To start the flow provide a HTTP Client that implements
PSR-18 CLientInterface,
and the required options seen in the example beneath.
Note that this example uses Guzzle HTTP Client. For a list of PSR-18 implementing libraries click here.
use GuzzleHttp\Client;
use ItkDev\AzureAdDeltaSync\Controller;
$options = [
'uri' => 'https://aarhus.../RetrieveProvisioningData/...', // System provisioning uri
'security_key' => 'some_security_key', // Provisioning data security key
'client_secret' => 'some_client_secret', // System provisioning client secret
];
$handler = new SomeHandler();
$client = new Client();
$controller = new Controller($client, $this->options);
$controller->run($handler);Note that this package does not do the synchronization of users, instead it provides a list of all users that currently has access to the system in question.
Should the configured system contain no users an exception will be thrown. This is to avoid using systems to be under the impression that every single user should be deleted.
A docker-compose.yml file with a PHP 8.2 image is included in this project.
To install the dependencies you can run
docker compose pull
docker compose up -d
docker compose exec phpfpm composer installWe use PHPUnit for unit testing. To run the tests:
docker compose exec phpfpm composer install
docker compose exec phpfpm ./vendor/bin/phpunit testsThe test suite uses Mocks for generation of test doubles.
Check PHP coding standards
docker compose run --rm phpfpm composer install
docker compose run --rm phpfpm composer coding-standards-checkApply coding standard changes
docker compose run --rm phpfpm composer coding-standards-applydocker run --rm --volume "$PWD:/md" itkdev/markdownlint '**/*.md'
docker run --rm --volume "$PWD:/md" itkdev/markdownlint '**/*.md' --fixAll code checks mentioned above are automatically run by GitHub Actions when a pull request is created.
To run the actions locally, install act and run
act -P ubuntu-latest=shivammathur/node:focal pull_requestUse act -P ubuntu-latest=shivammathur/node:focal pull_request --list to see
individual workflow jobs that can be run, e.g.
act -P ubuntu-latest=shivammathur/node:focal pull_request --job phpcsfixerWe use SemVer for versioning. For the versions available, see the tags on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details