- Removed the old `connected-apps.create` implementation and components, simplifying the codebase. - Introduced modular OIDC integration using reusable components and traits, such as `WithSearchableChoices` and `WithRepeaterFields`. - Added `StoreOIDCAppForm` for handling OpenID Connect app-specific fields and validation. - Updated `choices.blade.php` and related components to leverage configuration-driven, dynamic multi-select functionality. - Updated routes to support new OIDC app creation under distinct connection protocol namespaces. - Enhanced app creation flow with support for dynamic fields like URIs (`repeater-input`) and scoped user roles.
55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Livewire\Forms;
|
|
|
|
use App\Enums\UserAccessTypeEnum;
|
|
use Livewire\Attributes\Validate;
|
|
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
|
use Livewire\Form;
|
|
|
|
class StoreOIDCAppForm extends Form
|
|
{
|
|
#[Validate('required|string|max:255|min:3')]
|
|
public string $name = '';
|
|
|
|
#[Validate('nullable|image|max:1024')]
|
|
public ?TemporaryUploadedFile $logo = null;
|
|
|
|
/** @var string[] */
|
|
#[Validate([
|
|
'signInUris' => 'nullable',
|
|
'signInUris.*' => ['nullable', 'url'],
|
|
], message: 'The sign in URI must be a valid URL.')]
|
|
public array $signInUris = [''];
|
|
|
|
/** @var string[] */
|
|
#[Validate([
|
|
'signOutUris' => 'nullable',
|
|
'signOutUris.*' => ['nullable', 'url'],
|
|
])]
|
|
public array $signOutUris = [''];
|
|
|
|
#[Validate([
|
|
'userAccessOption' => 'required|in:'.UserAccessTypeEnum::Everyone->value.','.UserAccessTypeEnum::Role->value,
|
|
])]
|
|
public string $userAccessOption = UserAccessTypeEnum::Everyone->value;
|
|
|
|
/** @var int[] */
|
|
#[Validate([
|
|
'roleIds' => 'required_if:userAccessOption,'.UserAccessTypeEnum::Role->value,
|
|
'roleIds.*' => ['integer', 'exists:roles,id'],
|
|
])]
|
|
public array $roleIds = [];
|
|
|
|
public function validationAttributes(): array
|
|
{
|
|
return [
|
|
'signInUris.*' => 'Sign-in URI',
|
|
'signOutUris.*' => 'Sign-out URI',
|
|
'roleIds.*' => 'Role',
|
|
];
|
|
}
|
|
}
|