Phase 6 (Teil 2): OpenID Connect, LDAP/AD und SAML 2
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m41s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m48s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m15s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m17s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m48s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m33s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m26s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m59s
All checks were successful
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 2m41s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 2m48s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m15s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m17s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 3m48s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 3m41s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 3m33s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m26s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 3m59s
- Gemeinsamer Treiber-Unterbau (App\Identity\IdentityDriver, IdentityDrivers, IdentityLogin, AttributeProfile); Entra ID nutzt ihn ebenfalls - Plugins oidc, ldap und saml mit Profil- und Gruppen-Zuordnung - Admin: Verfahren wählen, Formular je Verfahren, zuletzt empfangene Angaben - onelogin/php-saml als neue Abhängigkeit Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0ab0838050
commit
4fcc41ed30
172 changed files with 18940 additions and 293 deletions
|
|
@ -3,24 +3,45 @@
|
|||
namespace App\Filament\Resources\IdentityProviders\Pages;
|
||||
|
||||
use App\Filament\Resources\IdentityProviders\IdentityProviderResource;
|
||||
use App\Identity\IdentityDrivers;
|
||||
use App\Models\IdentityProvider;
|
||||
use App\Support\Audit;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Livewire\Attributes\Locked;
|
||||
|
||||
class CreateIdentityProvider extends CreateRecord
|
||||
{
|
||||
protected static string $resource = IdentityProviderResource::class;
|
||||
|
||||
/** Verfahren aus ?typ= – bestimmt das Formular. */
|
||||
#[Locked]
|
||||
public string $type = IdentityProvider::ENTRA;
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$type = (string) request()->query('typ', IdentityProvider::ENTRA);
|
||||
abort_unless(app(IdentityDrivers::class)->has($type), 404);
|
||||
$this->type = $type;
|
||||
|
||||
parent::mount();
|
||||
}
|
||||
|
||||
public function getTitle(): string
|
||||
{
|
||||
return app(IdentityDrivers::class)->get($this->type)->label().' anbinden';
|
||||
}
|
||||
|
||||
protected function mutateFormDataBeforeCreate(array $data): array
|
||||
{
|
||||
$data['type'] = IdentityProvider::ENTRA;
|
||||
$data['type'] = $this->type;
|
||||
$data['config']['attribute_map'] = array_values((array) ($data['config']['attribute_map'] ?? []));
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
protected function afterCreate(): void
|
||||
{
|
||||
Audit::log('identity.provider_created', ['provider' => $this->record->name]);
|
||||
Audit::log('identity.provider_created', ['provider' => $this->record->name, 'type' => $this->record->type]);
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace App\Filament\Resources\IdentityProviders\Pages;
|
||||
|
||||
use App\Filament\Resources\IdentityProviders\IdentityProviderResource;
|
||||
use App\Models\IdentityProvider;
|
||||
use App\Support\Audit;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\DeleteAction;
|
||||
|
|
@ -18,7 +19,9 @@ class EditIdentityProvider extends EditRecord
|
|||
*/
|
||||
protected function mutateFormDataBeforeFill(array $data): array
|
||||
{
|
||||
$data['config']['client_secret'] = null;
|
||||
foreach ($this->secretFields() as $field) {
|
||||
$data['config'][$field] = null;
|
||||
}
|
||||
|
||||
// Ältere Konfiguration (feste Feldliste) als Zuordnung anzeigen.
|
||||
if (! is_array($data['config']['attribute_map'] ?? null)) {
|
||||
|
|
@ -35,18 +38,31 @@ class EditIdentityProvider extends EditRecord
|
|||
*/
|
||||
protected function mutateFormDataBeforeSave(array $data): array
|
||||
{
|
||||
if (blank($data['config']['client_secret'] ?? null)) {
|
||||
$data['config']['client_secret'] = $this->record->setting('client_secret');
|
||||
foreach ($this->secretFields() as $field) {
|
||||
if (blank($data['config'][$field] ?? null)) {
|
||||
$data['config'][$field] = $this->record->setting($field);
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->record->type === IdentityProvider::ENTRA) {
|
||||
// Geladene Erweiterungen liegen nur in der Datenbank, nicht im Formular.
|
||||
$data['config']['extension_properties'] = $this->record->fresh()?->setting('extension_properties', []) ?? [];
|
||||
}
|
||||
|
||||
// Geladene Erweiterungen liegen nur in der Datenbank, nicht im Formular.
|
||||
$data['config']['extension_properties'] = $this->record->fresh()?->setting('extension_properties', []) ?? [];
|
||||
$data['config']['attribute_map'] = array_values((array) ($data['config']['attribute_map'] ?? []));
|
||||
unset($data['config']['synced_fields']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list<string>
|
||||
*/
|
||||
private function secretFields(): array
|
||||
{
|
||||
return $this->record->driver()?->secretFields() ?? ['client_secret', 'bind_password'];
|
||||
}
|
||||
|
||||
protected function afterSave(): void
|
||||
{
|
||||
Audit::log('identity.provider_updated', ['provider' => $this->record->name, 'enabled' => $this->record->enabled]);
|
||||
|
|
@ -56,8 +72,9 @@ class EditIdentityProvider extends EditRecord
|
|||
{
|
||||
return [
|
||||
Action::make('test')->label('Mapping testen')->icon(Heroicon::OutlinedBeaker)->color('gray')
|
||||
->visible($this->record->type === IdentityProvider::ENTRA)
|
||||
->url(fn () => IdentityProviderResource::getUrl('test', ['record' => $this->record])),
|
||||
DeleteAction::make()->modalDescription('Verknüpfungen und Rollen aus Entra-Gruppen werden entfernt. Die Konten selbst bleiben bestehen.'),
|
||||
DeleteAction::make()->modalDescription('Verknüpfungen und Rollen aus Gruppen dieses Anbieters werden entfernt. Die Konten selbst bleiben bestehen.'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,11 @@
|
|||
namespace App\Filament\Resources\IdentityProviders\Pages;
|
||||
|
||||
use App\Filament\Resources\IdentityProviders\IdentityProviderResource;
|
||||
use Filament\Actions\CreateAction;
|
||||
use App\Identity\IdentityDrivers;
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Actions\ActionGroup;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
|
||||
class ListIdentityProviders extends ListRecords
|
||||
{
|
||||
|
|
@ -12,6 +15,14 @@ class ListIdentityProviders extends ListRecords
|
|||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [CreateAction::make()->label('Microsoft Entra ID anbinden')];
|
||||
$actions = collect(app(IdentityDrivers::class)->all())->map(fn ($driver, $type) => Action::make('create_'.$type)
|
||||
->label($driver->label())
|
||||
->tooltip($driver->description() ?: null)
|
||||
->url(IdentityProviderResource::getUrl('create', ['typ' => $type])))
|
||||
->values()->all();
|
||||
|
||||
return [
|
||||
ActionGroup::make($actions)->label('Anmeldeverfahren hinzufügen')->icon(Heroicon::OutlinedPlus)->button()->color('primary'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Filament\Resources\IdentityProviders\Pages;
|
|||
|
||||
use App\Filament\Resources\IdentityProviders\IdentityProviderResource;
|
||||
use App\Identity\Entra\MappingTester;
|
||||
use App\Models\IdentityProvider;
|
||||
use Filament\Resources\Pages\Concerns\InteractsWithRecord;
|
||||
use Filament\Resources\Pages\Page;
|
||||
use Throwable;
|
||||
|
|
@ -32,6 +33,7 @@ class TestMapping extends Page
|
|||
public function mount(int|string $record): void
|
||||
{
|
||||
$this->record = $this->resolveRecord($record);
|
||||
abort_unless($this->record->type === IdentityProvider::ENTRA, 404);
|
||||
}
|
||||
|
||||
public function test(MappingTester $tester): void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue