/engineering:saas-sso-scim-enterprise-authfrom engineering
Guides implementation of tenant-scoped SAML/OIDC SSO, SCIM provisioning, custom domains, and IP allowlists for B2B SaaS enterprise auth.
Ships in engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
| Input | Required | Use |
|---|---|---|
| Tenant, product, and lifecycle scope | yes | Bound the SaaS decision |
| Current architecture, plans, policies, and constraints | yes | Preserve enforceable behaviour |
| Production data or verified evidence | conditional | Validate thresholds and migrations |
Skill-specific inputs:
saas-architecture-strategy (users + memberships).subscription-billing (which plan gates enterprise auth).saas-architecture-strategy / multi-tenant-saas-architecture.Default to read-only analysis. Change configuration, billing, identity, tenant data, infrastructure, or customer communications only with explicit authority, least-privilege credentials, tenant scope, rollback, and auditable approval. Never expose secrets or cross tenant boundaries.
If production access, policy, telemetry, or authoritative records are unavailable, produce a labelled design or dry-run plan. Do not claim deployment, reconciliation, deletion, delivery, or measured outcomes; list missing evidence and verification.
| Condition | Action | Stop condition |
|---|---|---|
| Tenant isolation, money, identity, or deletion is affected | Require approval and rollback evidence | Scope or authority is ambiguous |
| Evidence supports a reversible change | Stage, test, and record it | Acceptance checks fail |
| Only partial context is available | Return assumptions and validation | A production claim cannot be verified |
app.customer.com) with automated cert provisioning.vibe-security-skill.vibe-security-skill + MFA + the back-office privileged-access workflow in saas-admin-backoffice-tooling.vibe-security-skill.SKILL.md.InResponseTo, recent timestamp).Operations).saas-entitlements-and-plan-gating.| Category | Artifact | Format | Example |
|---|---|---|---|
| Security | Enterprise auth ADR | ADR markdown | docs/adr/0015-enterprise-auth.md |
| Security | Per-tenant IdP config schema | Markdown doc + SQL | docs/saas/tenant-idp-config.md |
| Release evidence | SCIM endpoint spec | Markdown doc with example payloads | docs/saas/scim-spec.md |
references/saml-implementation.md — SAML 2.0 flow, attribute mapping, validation pitfalls.references/scim-provisioning.md — SCIM 2.0 endpoints, PATCH semantics, Okta/Azure quirks.references/custom-domain-and-tls.md — DNS verification, cert-manager, fingerprint validation.references/audit-log-api.md — API surface, retention, format.multi-tenant-saas-architecture, vibe-security-skill, saas-architecture-strategy, saas-entitlements-and-plan-gating.Selling to enterprises requires:
app.customer.com CNAME).Mersch (Hacking SaaS) is emphatic — these are not edge cases; they are price of entry to the enterprise segment. Shipping the first enterprise deal without them stalls a four-week deal into a four-month deal.
| Option | Cost | Time | Notes |
|---|---|---|---|
| WorkOS | $$$ | 1-2 weeks | Best-in-class enterprise auth API; SAML + SCIM + Directory Sync; charges per active connection |
| Frontegg | $$$ | 1-2 weeks | All-in-one B2B identity, includes admin portal for tenants |
| Ory (open source / managed) | $-$$$ | 2-4 weeks | Self-hostable; more control; more ops |
| Auth0 Enterprise | $$$$ | 1-2 weeks | Mature; expensive at scale |
| Clerk | $$$ | 1 week | Strong DX; expanding enterprise feature set |
| AWS Cognito | $-$$ | 2-4 weeks | If already on AWS; SAML works; SCIM limited |
| Roll custom | Eng time | 2-3 months | Don't. The auth surface is enormous and one bug is a CVE. |
Default recommendation for SaaS up to $10M ARR: WorkOS (best ROI on enterprise-auth complexity). Migrate to in-house only if cost + control require it at $50M+ ARR.
CREATE TABLE tenant_idp_configurations (
tenant_id BIGINT UNSIGNED PRIMARY KEY,
enforced BOOLEAN NOT NULL DEFAULT FALSE, -- if true, email-password blocked
protocol ENUM('saml','oidc','none') NOT NULL DEFAULT 'none',
-- SAML
saml_metadata_xml TEXT,
saml_entity_id VARCHAR(255),
saml_sso_url VARCHAR(512),
saml_certificate TEXT,
saml_attr_email VARCHAR(128) DEFAULT 'NameID',
saml_attr_name VARCHAR(128) DEFAULT 'displayName',
saml_attr_groups VARCHAR(128) DEFAULT 'groups',
-- OIDC
oidc_issuer VARCHAR(512),
oidc_client_id VARCHAR(255),
oidc_client_secret VARCHAR(512), -- encrypted at rest
-- SCIM
scim_enabled BOOLEAN NOT NULL DEFAULT FALSE,
scim_bearer_token_hash CHAR(64), -- SCIM endpoint auth
scim_group_mapping JSON, -- IdP group → tenant role
-- Misc
domain_verified BOOLEAN NOT NULL DEFAULT FALSE, -- buyer proved ownership of email domain
email_domain VARCHAR(255), -- e.g., 'acme.com'
configured_by BIGINT UNSIGNED,
configured_at DATETIME,
updated_at DATETIME
);
Domain claim flow is essential — if any user with email @acme.com can claim the Acme tenant, you have a takeover risk. Domain verification via DNS TXT record or a verified-by-IT click flow.
| Endpoint | Purpose |
|---|---|
GET /sso/saml/{tenant}/metadata | Your platform's SP metadata XML |
POST /sso/saml/{tenant}/acs | Assertion Consumer Service — IdP posts SAMLResponse here |
GET /sso/saml/{tenant}/login | SP-initiated login (redirect to IdP) |
GET /sso/saml/{tenant}/logout | Single Logout (SLO) initiation |
POST /sso/saml/{tenant}/sls | Single Logout Service — IdP posts logout here |
User → app.example.com → "Sign in with SSO" → enters email → email domain → resolve tenant
→ redirect to /sso/saml/{tenant}/login
→ SAMLRequest built, signed, redirect to tenant.saml_sso_url
→ User authenticates at IdP
→ IdP posts SAMLResponse to /sso/saml/{tenant}/acs
→ Validate signature, audience, recipient, NotBefore/NotOnOrAfter, InResponseTo
→ Extract attributes (email, name, groups)
→ Match or create user; bind to tenant; resolve roles from group mapping
→ Issue platform session
→ Redirect to app
NotOnOrAfter in the past.Recipient does not match your ACS URL.Audience does not match your SP entity ID.Assertion.ID for the validity window).python3-saml (OneLogin) — well-maintained.passport-saml / samlify.crewjam/saml.onelogin/php-saml.SCIM is push from IdP to platform — provisioning/deprovisioning runs on the IdP's schedule.
/scim/v2/{tenant}/)| Endpoint | Method | Purpose |
|---|---|---|
/Users | GET | List users (paginated) |
/Users | POST | Create user |
/Users/{id} | GET | Read user |
/Users/{id} | PUT | Replace user |
/Users/{id} | PATCH | Partial update (most-used) |
/Users/{id} | DELETE | Deprovision user |
/Groups | GET / POST / etc. | Group CRUD |
/ServiceProviderConfig | GET | Platform capabilities |
/Schemas | GET | Resource schemas |
/ResourceTypes | GET | Resource types |
Bearer token per tenant. Tenant admin generates it once in the platform UI; pastes into Okta/Azure SCIM connector.
PATCH /Users/{id} body:
{
"schemas": ["urn:ietf:params:scim:api:messages:2.0:PatchOp"],
"Operations": [
{"op": "replace", "path": "active", "value": false}
]
}
Implementing PATCH correctly is the hardest SCIM problem. Test against Okta + Azure AD + OneLogin payloads — they all send slightly different shapes.
Map IdP groups (e.g., acme-saas-admins) to your platform roles (e.g., admin). Stored in tenant_idp_configurations.scim_group_mapping.
Customer wants their users to log in at app.acme.com instead of acme.your-saas.com.
app.acme.com in your platform's domain settings.app.acme.com CNAME tenant-acme.your-saas.com.Edge layer (nginx / Cloudflare / ALB) accepts the custom domain; SNI extracts hostname; resolves to tenant; routes to backend with X-Tenant-Id header. The backend trusts the header only because it came from the trusted edge.
Enforced at the edge (WAF / ALB / Cloudflare / Cloudfront). App-layer enforcement is a fallback only.
CREATE TABLE tenant_ip_allowlists (
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
tenant_id BIGINT UNSIGNED NOT NULL,
cidr VARCHAR(43) NOT NULL,
description VARCHAR(255),
added_by BIGINT UNSIGNED,
added_at DATETIME NOT NULL,
INDEX idx_tenant (tenant_id)
);
Edge consults the allowlist (cached) and rejects with 403 before the request hits the app. App-layer enforcement is a safety net but never the sole gate.
Caveats:
Customers want to pull audit logs into Splunk/Datadog/Elastic.
GET /api/v1/admin/audit-log?from=2026-05-01T00:00:00Z&cursor=<opaque>
Authorization: Bearer <tenant_admin_api_key>
→ 200 OK
{
"data": [ { id, occurred_at, actor_email, action, target_resource, target_id, ip, metadata } ],
"cursor": "<next-page-opaque>",
"has_more": true
}
Pagination: cursor-based, not page-based (avoid skip-N inefficiency at large scale).
Retention exposed via /api/v1/admin/audit-log/retention-policy.
What to include: tenant-scoped events the customer cares about — user login/logout, MFA changes, role changes, plan changes, member invited/removed, data export, integration created/revoked.
Once tenant configures SSO, decide:
Enforced is the enterprise expectation. Migration steps:
tenant_idp_configurations.enforced = TRUE.Break-glass: super-admin in the back-office can temporarily disable enforcement for a tenant (audited, time-boxed, justified).
vibe-security-skill — base auth implementation this skill extends.multi-tenant-saas-architecture — tenant binding model.saas-architecture-strategy — identity service this skill plugs into.saas-entitlements-and-plan-gating — gate enterprise auth behind enterprise plan.saas-admin-backoffice-tooling — staff break-glass workflow.vibe-security-skill — security review baseline.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub peterbamuhigire/chwezi-dev-engine --plugin engineering169 skills in this plugin
/accounting-engineUse when designing or implementing double-entry accounting policy and an embedded ledger engine for invoices, payments, stock, balanced postings, mapped accounts, idempotency, reversals, period locks, audit trails, and financial statements./accounting-finance-controllerUse when coordinating accounting and finance implementation reviews, doctrine routing, control evidence, remediation priorities, and release decisions across a software system./advanced-testing-strategyUse when designing or reviewing test strategy for production systems, APIs, mobile apps, SaaS platforms, ERP workflows, and AI-enabled systems. Covers unit, integration, contract, end-to-end, regression, release-gate, and risk-based testing decisions.Other plugins' skills for the same job