- Implemented `EnumMorphsToOptionsContract` interface to enable enums with options and labels for dropdowns. - Created `SamlNameIdFormatEnum` and `SamlNameIdSourceEnum` for standardized SAML NameID configuration. - Added reusable `SAML Configuration` Blade component for easier integration into connected app forms. - Enabled custom SAML Attribute mapping with dynamic add/remove functionality and validation. - Improved `SamlIdpController` to enforce ACS URL matching and user authorization checks. - Refactored SAML-related tests and added scenarios for role-based SAML access and custom configurations.
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Enums;
|
|
|
|
use App\Contracts\EnumMorphsToOptionsContract;
|
|
|
|
enum SamlNameIdFormatEnum: string implements EnumMorphsToOptionsContract
|
|
{
|
|
case Persistent = 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent';
|
|
case Email = 'urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress';
|
|
case Transient = 'urn:oasis:names:tc:SAML:2.0:nameid-format:transient';
|
|
case Unspecified = 'urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified';
|
|
|
|
// We will store enum values in the settings of the app, which will mapped to URN later.
|
|
public static function asOptions(): array
|
|
{
|
|
return array_map(fn (self $enum) => [
|
|
'name' => $enum->toLabel(),
|
|
'value' => mb_strtolower($enum->name),
|
|
], self::cases());
|
|
}
|
|
|
|
public function toLabel(): string
|
|
{
|
|
return match ($this) {
|
|
self::Persistent => 'Persistent',
|
|
self::Email => 'Email Address',
|
|
self::Transient => 'Transient',
|
|
self::Unspecified => 'Unspecified',
|
|
};
|
|
}
|
|
}
|