Problem
The client portal already supports Microsoft Entra ID (Azure AD) SSO login (client/login_microsoft.php), but technicians/agents have no SSO option at all - only local username/password.
Proposed approach
- A separate Entra App Registration for agent SSO (
config_azure_agent_client_id / config_azure_agent_client_secret), distinct from the existing client portal app, so staff and client sign-in can be scoped/consented independently.
- Settings > Identity Providers gains an "Agent/Technician Portal SSO" section to configure it, showing the redirect URI to register in Entra.
- New
agent/login_microsoft.php mirrors the client portal's existing OAuth2 authorization code flow, but matches the signed-in Microsoft account against the users table directly (user_type = 1, i.e. agents) and never joins against contacts/clients - so it cannot match a client portal account regardless of email overlap.
- Technician accounts get an Auth Method selector (Local / Microsoft Entra) on the user edit modal, matching the existing pattern already used for client contacts.
- A "Sign in as Agent with Microsoft Entra" button appears on the unified login page once an agent app registration is configured (hidden otherwise).
- A DB migration adds the two new settings columns, following the existing per-version
admin/database_updates/ convention.
This is incremental (no new runtime dependencies, no framework changes) and mirrors an existing, working pattern in the codebase rather than introducing a new one.
Status
Implemented and tested against a live install (fresh php -l sweep, end-to-end OAuth redirect test with a dummy App Registration, verified non-agent Entra accounts are cleanly rejected). Branch is ready on my fork: thvevirtue/itflow@master...thvevirtue:itflow:feature/agent-entra-sso
I understand PRs from the community are currently paused - opening this as an issue first per CONTRIBUTING.md's guidance to discuss approach before submitting anything larger than a bug fix. Happy to open a PR once the approach is agreed and/or PRs reopen.
Problem
The client portal already supports Microsoft Entra ID (Azure AD) SSO login (
client/login_microsoft.php), but technicians/agents have no SSO option at all - only local username/password.Proposed approach
config_azure_agent_client_id/config_azure_agent_client_secret), distinct from the existing client portal app, so staff and client sign-in can be scoped/consented independently.agent/login_microsoft.phpmirrors the client portal's existing OAuth2 authorization code flow, but matches the signed-in Microsoft account against theuserstable directly (user_type = 1, i.e. agents) and never joins againstcontacts/clients- so it cannot match a client portal account regardless of email overlap.admin/database_updates/convention.This is incremental (no new runtime dependencies, no framework changes) and mirrors an existing, working pattern in the codebase rather than introducing a new one.
Status
Implemented and tested against a live install (fresh
php -lsweep, end-to-end OAuth redirect test with a dummy App Registration, verified non-agent Entra accounts are cleanly rejected). Branch is ready on my fork: thvevirtue/itflow@master...thvevirtue:itflow:feature/agent-entra-ssoI understand PRs from the community are currently paused - opening this as an issue first per CONTRIBUTING.md's guidance to discuss approach before submitting anything larger than a bug fix. Happy to open a PR once the approach is agreed and/or PRs reopen.