# OidcProvidersEvent events

> 3 FeatherPanel plugin events on OidcProvidersEvent (3 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.

Source: https://featherpanel.com/docs/plugins/events/oidc-providers/

Part of the [plugin events reference](https://featherpanel.com/docs/plugins/events/). Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions.

## Setup

Import `OidcProvidersEvent` in your entry class and register listeners in `processEvents()`:

```php
<?php

namespace App\Addons\myplugin;

use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\OidcProvidersEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(OidcProvidersEvent::onOidcProviderCreated(), function ($userUuid, $provider): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:oidc:provider:create ' . json_encode(['user_uuid' => $userUuid, 'provider' => $provider]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}
```

## `OidcProvidersEvent::onOidcProviderCreated()`

- Name: `featherpanel:oidc:provider:create`
- emitted at 1 site
- Cancel or modify: no
- [definition](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Plugins/Events/Events/OidcProvidersEvent.php#L27)

Docblock: string|null user uuid, array provider.

| # | Payload key | Listener parameter | Type |
| --- | --- | --- | --- |
| 1 | `user_uuid` | `$userUuid` | `string|null`from docblock |
| 2 | `provider` | `$provider` | `array`from docblock |

When it fires (1 site)

-   [`OidcProvidersController::create`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/OidcProvidersController.php#L139) via `emitEvent()`[`PUT /api/admin/oidc/providers`](https://featherpanel.com/docs/api/reference/admin/oidc/#put-admin-oidc-providers)

```php
$event->on(OidcProvidersEvent::onOidcProviderCreated(), function ($userUuid, $provider): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:oidc:provider:create ' . json_encode(['user_uuid' => $userUuid, 'provider' => $provider]));
});
```

## `OidcProvidersEvent::onOidcProviderDeleted()`

- Name: `featherpanel:oidc:provider:delete`
- emitted at 1 site
- Cancel or modify: no
- [definition](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Plugins/Events/Events/OidcProvidersEvent.php#L43)

Docblock: string|null user uuid, array provider.

| # | Payload key | Listener parameter | Type |
| --- | --- | --- | --- |
| 1 | `user_uuid` | `$userUuid` | `string|null`from docblock |
| 2 | `provider` | `$provider` | `array`from docblock |

When it fires (1 site)

-   [`OidcProvidersController::delete`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/OidcProvidersController.php#L286) via `emitEvent()`[`DELETE /api/admin/oidc/providers/{uuid}`](https://featherpanel.com/docs/api/reference/admin/oidc/#delete-admin-oidc-providers-uuid)

```php
$event->on(OidcProvidersEvent::onOidcProviderDeleted(), function ($userUuid, $provider): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:oidc:provider:delete ' . json_encode(['user_uuid' => $userUuid, 'provider' => $provider]));
});
```

## `OidcProvidersEvent::onOidcProviderUpdated()`

- Name: `featherpanel:oidc:provider:update`
- emitted at 1 site
- Cancel or modify: no
- [definition](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Plugins/Events/Events/OidcProvidersEvent.php#L35)

Docblock: string|null user uuid, array provider, array changed fields.

| # | Payload key | Listener parameter | Type |
| --- | --- | --- | --- |
| 1 | `user_uuid` | `$userUuid` | `string|null`from docblock |
| 2 | `provider` | `$provider` | `array`from docblock |
| 3 | `changed_fields` | `$changedFields` | `array` |

When it fires (1 site)

-   [`OidcProvidersController::update`](https://github.com/MythicalLTD/FeatherPanel/blob/15b94e9fc9df233123706b47c42728b81e48cb3d/backend/app/Controllers/Admin/OidcProvidersController.php#L240) via `emitEvent()`[`PATCH /api/admin/oidc/providers/{uuid}`](https://featherpanel.com/docs/api/reference/admin/oidc/#patch-admin-oidc-providers-uuid)

```php
$event->on(OidcProvidersEvent::onOidcProviderUpdated(), function ($userUuid, $provider, $changedFields): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:oidc:provider:update ' . json_encode(['user_uuid' => $userUuid, 'provider' => $provider, 'changed_fields' => $changedFields]));
});
```
