This commit adds a detailed breakdown of tasks for the 063-entra-signin feature. The tasks are categorized into phases: Setup & Core Authentication Flow, Filament Panel Integration & UX, Testing, and Documentation & Deployment. This task list serves as a guide for implementing the feature based on the technical plan.
4.6 KiB
4.6 KiB
Tasks: 063 — Entra Sign-in (Tenant Panel) v1
Feature Branch: 063-entra-signin
Created: 2026-01-26
Status: Draft (v1)
Spec: specs/063-entra-signin/spec.md
Plan: specs/063-entra-signin/plan.md
Phase 1: Setup & Core Authentication Flow
- Task 063.01: Install and configure Laravel Socialite and Socialite Providers for Azure AD.
- Add
laravel/socialiteandsocialiteproviders/microsoft-azure-active-directorytocomposer.json. - Configure
config/services.phpforazureprovider withclient_id,client_secret,redirect. - Update
.env.examplewith placeholder variables (AZURE_CLIENT_ID, etc.).
- Add
- Task 063.02: Implement
SocialiteControllerto handle redirect and callback.- Create
app/Http/Controllers/Auth/AzureLoginController.php. - Define
redirect()method to initiate Entra OIDC flow. - Define
callback()method to process Entra response.
- Create
- Task 063.03: Define authentication routes.
- Add routes to
routes/web.phpfor/auth/entra/redirectand/auth/entra/callback.
- Add routes to
- Task 063.04: Database migration for
userstable.- Create migration to add
entra_tenant_id(uuidorstring(36)) andentra_object_id(uuidorstring(36)) columns touserstable. - Add unique index
unique(['entra_tenant_id', 'entra_object_id']). - Ensure
nameandemailcolumns are compatible with Entra claims.
- Create migration to add
- Task 063.05: Implement user upsert logic in callback.
- In
callback()method, useUser::updateOrCreatebased on(entra_tenant_id, entra_object_id). - Populate
name,emailfrom claims. - Generate and regenerate session.
- In
- Task 063.06: Handle OIDC failure safely (logging and redirect).
- Implement error handling in
callback()for missingtid/oidclaims. - Redirect to
/admin/loginwith generic error. - Log
auth.entra.loginevents withsuccess: false,reason_code,correlation_id(no tokens/claims).
- Implement error handling in
Phase 2: Filament Panel Integration & UX
- Task 063.07: Override Filament login page for
/adminpanel.- Create a custom Filament login page that replaces the default email/password form with a "Sign in with Microsoft" button.
- Link the button to
/auth/entra/redirectroute.
- Task 063.08: Implement
NoAccessPage.- Create a Filament page at
/admin/no-accessfor users with 0 tenant memberships. - Ensure it renders Filament UI and provides a user-friendly message.
- Create a Filament page at
- Task 063.09: Implement
TenantChooserPage.- Create a Filament page at
/admin/choose-tenantfor users with N > 1 tenant memberships. - Display a list of available tenants, allowing the user to select one.
- Implement logic to redirect to the chosen tenant's dashboard.
- Create a Filament page at
- Task 063.10: Implement post-login routing logic.
- In
callback()method, after successful user upsert and session regeneration:- Retrieve user's tenant memberships.
- Implement conditional redirects: 0 memberships to
/admin/no-access, 1 to tenant dashboard, N to/admin/choose-tenant.
- In
- Task 063.11: Implement disabled user login blocking.
- In
callback()method, after user upsert, check if the user is disabled/soft-deleted. - If disabled, block login, redirect to
/admin/loginwith generic error. - Log
auth.entra.loginwithreason_code: user_disabled.
- In
Phase 3: Testing
- Task 063.12: Write Unit Tests for core logic.
- Test
SocialiteController'scallback()method logic (claim validation, upsert, disabled user check). - Test
Usermodel methods related to Entra ID and tenant relationships.
- Test
- Task 063.13: Write Feature Tests for acceptance criteria.
AdminLoginIsEntraOnlyTest.EntraCallbackUpsertByTidOidTest.PostLoginRoutingByMembershipTest(covering 0, 1, N memberships).OidcFailureRedirectsSafelyTest.SessionSeparationSmokeTest.DisabledUserLoginIsBlockedTest.
- Task 063.14: Write Browser Tests for end-to-end flows.
- Verify successful Entra login and redirection.
- Verify
TenantChooserPagefunctionality.
- Task 063.15: Run
pintfor code style.
Phase 4: Documentation & Deployment
- Task 063.16: Update documentation (README or in-app help) if needed.
- Task 063.17: Verify deployment considerations.
- Confirm environment variables are managed.
- Ensure
php artisan filament:assetsis in deployment pipeline. - Update Dokploy config if necessary for new routes/pages.