- 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.
61 lines
3.1 KiB
PHP
61 lines
3.1 KiB
PHP
@php use App\Enums\SamlNameIdFormatEnum;use App\Enums\SamlNameIdSourceEnum; @endphp
|
|
@props(['form'])
|
|
<div class="md:col-span-2 grid grid-cols-1 md:grid-cols-2 gap-4 border-t border-gray-200 pt-4 mt-2">
|
|
<h3 class="font-semibold text-sm text-blue-600 md:col-span-2">SAML Configuration</h3>
|
|
<x-mary-input wire:model="form.samlEntityId" required :label="__('SAML Entity ID (Audience)')"
|
|
placeholder="e.g. urn:federation:MicrosoftOnline"/>
|
|
<x-mary-input wire:model="form.samlAcsUrl" required :label="__('SAML ACS URL (Callback)')"
|
|
placeholder="e.g. https://login.microsoftonline.com/login.srf"/>
|
|
|
|
<x-mary-select
|
|
wire:model="form.samlNameIdFormat"
|
|
:label="__('SAML NameID Format')"
|
|
:options="SamlNameIdFormatEnum::asOptions()"
|
|
option-value="value"
|
|
/>
|
|
<x-mary-select
|
|
wire:model="form.samlNameIdSource"
|
|
:label="__('SAML NameID Source')"
|
|
:options="SamlNameIdSourceEnum::asOptions()"
|
|
option-value="value"
|
|
/>
|
|
|
|
<div class="md:col-span-2 border-t border-gray-200 pt-4 mt-2">
|
|
<div class="flex justify-between items-center mb-2">
|
|
<h4 class="text-xs font-semibold text-blue-600">Attribute/Claims Mapping</h4>
|
|
<x-mary-button wire:click.prevent="addSamlAttribute" spinner label="Add Mapping" icon="lucide.plus"
|
|
class="btn-xs btn-outline btn-primary"/>
|
|
</div>
|
|
@if(empty($form->samlAttributes))
|
|
<p class="text-xs text-gray-400 italic">No custom attribute mapping defined. Default
|
|
Microsoft claims will be used.</p>
|
|
@else
|
|
<div class="space-y-2">
|
|
@foreach($form->samlAttributes as $index => $attr)
|
|
<div class="flex gap-2 items-center" wire:key="saml-attr-{{ $index }}">
|
|
<x-mary-input wire:model="form.samlAttributes.{{ $index }}.saml_name"
|
|
placeholder="SAML Claim Name (e.g. mail)"
|
|
class="input-sm flex-1"/>
|
|
<x-mary-select
|
|
wire:model="form.samlAttributes.{{ $index }}.user_field"
|
|
:options="[
|
|
['id' => 'email', 'name' => 'User Email'],
|
|
['id' => 'name', 'name' => 'User Name'],
|
|
['id' => 'immutable_id', 'name' => 'User Immutable ID'],
|
|
['id' => 'id', 'name' => 'User ID (Local)']
|
|
]"
|
|
class="select-sm w-44"
|
|
/>
|
|
<x-mary-button
|
|
wire:click.prevent="removeSamlAttribute({{ $index }})"
|
|
spinner
|
|
icon="lucide.trash-2"
|
|
class="btn-sm btn-error btn-circle btn-soft"
|
|
/>
|
|
</div>
|
|
@endforeach
|
|
</div>
|
|
@endif
|
|
</div>
|
|
</div>
|