singleloginsystem/app/Enums/SamlNameIdFormatEnum.php
= aaa258903c Feat: Add enhanced SAML configuration and attribute mapping support
- 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.
2026-06-08 12:56:28 +00:00

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',
};
}
}