Configuring n8n SSO and security policies as code

Manage n8n identity settings from environment variables, OIDC variables and deployment files so SSO and security policies are reviewed, versioned and reproducible. Confirm plan and version support before you start.

On this page

How n8n SSO configuration as code keeps identity settings reviewable

Configuring n8n SSO as code means recording identity and security settings in files your team versions and reviews, then applying them through environment variables when the instance starts. Setting SSO in the admin UI changes one running instance, so a test server, a production server and a rebuilt recovery server can drift apart without anyone noticing. Environment variables, such as the N8N_SSO_MANAGED_BY_ENV flag, let the team state in one place which identity settings are authoritative, and locked UI controls stop administrators from overwriting those settings by hand. This matters most when you run several environments, rebuild instances from scratch, or must show an auditor how sign-in was configured at a given time.

Confirm your plan before you design any of this. n8n lists SSO and LDAP as included only in the Business and Enterprise plans, and its SAML single sign-on is available on those same plans, so a Community or Starter deployment cannot use the settings described here. Check the n8n pricing page for current inclusions, and ask your n8n contact whether the edition you need is self-hosted, since the Business plan is currently self-hosted only. Also confirm which protocol your identity provider will use, because the setup steps differ between SAML and OIDC and each needs its own test before enforcement.

Treat the identity configuration as a change under review. Keep the Helm values or Compose file in the same repository as your deployment code, require a second reviewer for changes to sign-in settings, and keep client secrets and certificate material out of the file itself, in a secret store your platform already audits. Then rebuild a test instance from that file alone and confirm that sign-in, role mapping and the locked controls behave as expected before the same file goes to production. A rebuild that succeeds from the repository is evidence an auditor can re-run, and it catches settings that someone once changed in the UI and never recorded.

Which configuration path fits your n8n SSO setup

This table compares four ways to set n8n identity settings: the admin UI, environment variables, Helm values and Compose files. Read each row against your own team's change control, because the right path depends on who is allowed to change sign-in behavior and how you prove that change was approved. The main takeaway is that settings changed in the UI are easy to make but hard to audit, while settings declared in version-controlled files are reviewable but need a deploy to take effect.

PathWho edits itReview and driftWhen it fits
Admin UIInstance owners and admins with access to the SSO settings pageChanges are not reviewed by default and leave no diff. Drift from documented intent is likely over time.Small instances, early testing, or a single team that accepts manual change records
Environment variables with N8N_SSO_MANAGED_BY_ENVPlatform or DevOps engineers who set the container or host environmentChanges go through your deployment pipeline and can be reviewed, but the variable set must be confirmed for your n8n version. Drift shows up as a mismatch between the running environment and the repository.Teams that want SSO settings locked against UI edits and managed in configuration
OIDC variablesEngineers who set them, after confirming the feature is available on your plan and versionReviewable as part of environment configuration. Confirm plan eligibility before relying on it, since the topic brief notes SSO is limited to Business and Enterprise plans.Organizations already running an OpenID Connect provider and on a plan that includes it
Helm values (Kubernetes)Platform engineers who own the chart values fileValues live in Git and pass through pull request review and GitOps tooling. Drift appears when someone runs helm upgrade with ad hoc flags or edits live objects.Instances already on Kubernetes that need repeatable, versioned standup across environments
Compose fileEngineers who maintain the host or single-server stackReviewable in Git, but the file often sits on a server and gets edited in place. Drift appears when the host file differs from the repository.Single-host or small-footprint deployments with a simple change process
Recovery and break-glass accessA named owner, separate from the SSO configurationConfirm how a local owner account behaves when SSO is locked. Record who holds it and test it before enforcing SSO.Every path, since a misconfigured SSO setting can lock out all users
Version confirmationWhoever approves the upgradeConfirm the exact variable names and plan eligibility against the n8n version in use before writing configuration. Settings can differ between releases.Before any path is adopted or upgraded

How identity settings flow from Git to a running n8n instance

The flow starts in a Git repository holding Compose or Helm values that describe identity settings, environment flags and locked UI controls, with no secret values stored there. A CI/CD job pulls those files, retrieves the sign-in client secret and the encryption key from a secret store, and deploys the main instance. Users are redirected to the identity provider for sign-in, which returns their identity to n8n. In queue mode, the worker and webhook processors also need the same encryption key to read credentials, so the key must reach them through the secret store and the database must be reachable from every processor. Check each trust boundary before enforcing SSO.

Illustrative flow showing where settings, secrets and the encryption key travel.

Environment variables, Helm charts and Compose files compared

Compose keeps the whole n8n configuration in one file on one host, which makes it easy to review and to rebuild. The weak point is secrets. Unless you move them, the encryption key and the OIDC client secret sit in plain files on that host, so file permissions and host access control carry most of the security load.

  • Secrets: keep the encryption key and OIDC client secret in a .env file with restricted permissions or in a host secret store, and reference them through variable substitution in the Compose file.
  • Per-environment overrides: use separate .env files or Compose override files for staging and production, and confirm which file wins when the same key appears twice in your Compose version.
  • Testing before rollout: run docker compose config to render the merged file, then start a disposable copy with staging identity settings and complete a test sign-in.
  • After a rebuild: confirm the instance still reads existing credentials, that SSO sign-in works, that the local owner login matches your policy and that locked UI controls still apply.

Check that the rendered configuration never appears in logs, shell history or version control.

Standing up a fully configured n8n instance from code

This sequence produces an n8n instance whose sign-in, roles, secrets and security settings are defined in version-controlled files and can be rebuilt on demand. Each step ends with a check, so the team confirms a setting works before the next step depends on it. Test in a non-production environment first, then promote the same files.

  1. Confirm plan, edition and version

    The platform owner confirms in writing that the chosen plan includes SSO, since n8n lists SSO and LDAP only on the Business and Enterprise plans. The target n8n version is pinned in the deployment files and checked against the release notes under review. Multi-main high availability is limited to Enterprise self-hosted deployments, so confirm that now if it is part of the design. Check: the quote or license names the plan, and the image tag in the test environment matches the version pinned in Git.

  2. Choose the identity protocol and provider settings

    The identity owner chooses SAML or OpenID Connect based on what the identity provider supports and what the security team has approved. They create the application in the provider and record the redirect or callback URLs, the client or audience identifiers, and the attributes or groups n8n will read. The n8n SAML user management guide is the starting point for SAML setups. Check: the provider's metadata or discovery endpoint loads from the network path the n8n host uses.

  3. Express identity settings as code

    The platform engineer writes the identity settings into the Compose file or Helm values. This includes the managed-by-environment switch N8N_SSO_MANAGED_BY_ENV and the OIDC variables for the chosen protocol, so the configuration lives in Git and goes through review. Confirm the exact variable names against the documentation for the pinned version, because names can change between releases. Check: the rendered Compose config or Helm template shows every identity variable with the expected value, and a second reviewer finds no unexplained changes in the diff.

  4. Move secrets out of plain configuration

    The platform engineer places the OIDC client secret, the database password and the encryption key in a secret store or an encrypted Kubernetes Secret source. The deployment files reference these secrets instead of containing their values. Kubernetes stores Secrets unencrypted in etcd by default, so confirm encryption at rest is configured, or use an external store through the Secrets Store CSI Driver. Check: a repository scan finds no secret values, and each secret reference resolves in the running container without appearing in logs.

  5. Set the encryption key for queue mode

    If queue mode is in use, the platform engineer makes the main instance's encryption key available to every worker and webhook processor, because those processes must decrypt credentials stored in the database. Keep the key in one secret reference that all processes read, so it is not copied by hand into several places. Ask the vendor or check the documentation for the procedure to follow if the key ever needs to change. Check: a test workflow that uses a stored credential runs on a worker and on a webhook processor.

  6. Enable locked UI controls and role policies

    The platform owner sets the security policies n8n should enforce from configuration, such as which sign-in methods remain available. They confirm that settings managed by environment variables are protected from change in the admin interface. Role mapping from identity provider groups is configured here too, using the mode supported by the pinned version. Check: an admin attempts to change an environment-managed setting in the interface, the change is blocked or reverts after a restart, and the team records the result.

  7. Test sign-in and recovery in a test environment

    The identity and platform teams deploy the same files to a test environment. They sign in with a test user from each mapped group, then sign in with the break-glass owner account that keeps a local login. They restart the instance and confirm that identity settings, role assignments and the owner login survive. Check: each test user lands in the expected instance and project roles, a user outside the mapped groups gets no access, and the break-glass account works while SSO is enforced.

  8. Promote the same files to production

    Once every test passes, the platform team deploys the same reviewed files to production. Only environment-specific values change, such as hostnames and secret references. The team records the commit that was promoted so it can be compared with the test deployment later. The owner of the identity provider runs the first production sign-in with the security team observing. Check: production runs from the same commit as the passing test environment, and a named user signs in successfully.

Which settings lock the UI and what still needs the admin console

Once an identity setting is controlled by environment variables, the admin console may stop being the place where you change it, so you need to know which settings are locked before you try to edit them in the UI. The main switch is N8N_SSO_MANAGED_BY_ENV, and the OIDC variables it governs are the ones most likely to be overridden on restart. Confirm the exact locking behavior for your installed version in the n8n docs before you rely on it, because which fields are read-only, whether a UI change is silently reverted, and whether the setting applies to SAML, OIDC and LDAP separately are details that can differ between releases. Record the answer in your runbook for each identity method you enable.

Break-glass access needs the most planning. If the identity provider is down, or a certificate or endpoint change breaks sign-in, the people who can fix it must still reach the instance. Decide in advance which local owner account stays available outside SSO, where its credentials are stored, and who can use it, then test that path in staging. Confirm how the owner account behaves when SSO is enforced, since a lock that blocks configuration changes can also block the recovery steps you planned. Keep the change log for these settings in the same repository as your Compose file or Helm values so the last known good state is easy to restore.

Test every identity change in a staging instance built from the same configuration code as production, with a test identity provider tenant or application where possible. Check login, role mapping and logout, then confirm the UI shows the locked state you expect. When a provider rotates its signing certificate or changes its metadata or discovery endpoints, treat it as a configuration change: update the value in code, redeploy staging, verify sign-in, then promote. Ask your identity team for the rotation calendar and the notice period they give, so you are not discovering an expired certificate during a login failure.

Security risks in n8n SSO as code

Managing SSO and security policies from code makes the configuration reviewable, but it also moves the risks into Git, Helm values, Kubernetes Secrets and the running instance. The cards below name the failure modes that matter most for this setup and the control to apply to each one before go-live.

Secrets committed to Git or Helm values

OIDC client secrets, the n8n encryption key and database passwords often end up in a values file or a Compose file that is committed with the rest of the configuration. Anyone with repository read access can then recover them. Keep these values in an external secret store or a sealed secret, reference them by name from the chart or Compose file, and scan commits for high-entropy strings before merge. Check the Git history as well as the current branch.

Shared encryption key across processors

In queue mode, the main instance's encryption key must be available to every worker and webhook processor so they can decrypt stored credentials. That makes the key a single point of exposure for every node that runs workflows. Restrict which pods or hosts receive the key, keep the same key value across all of them, and plan a rotation procedure before you need one. Confirm the exact steps with n8n's queue mode guidance.

Queue mode docs

Locking out all administrators

A wrong issuer URL, a mismatched redirect address or a changed attribute mapping can stop every SSO login at once. If the only administrator account depends on SSO, recovery means direct database work. Keep a local owner account that is excluded from SSO enforcement, store its credentials in a separate vault, and test each SSO change in a staging instance before it reaches production.

Unencrypted Kubernetes Secrets in etcd

Kubernetes stores Secrets unencrypted in etcd by default, so anyone who can read etcd snapshots or list Secrets through the API can read n8n credentials. Enable encryption at rest for the Secrets resource, restrict list and watch on Secrets to the service accounts that need them, and consider an external store through the Secrets Store CSI Driver. Verify the encryption configuration on the control plane, not only in the manifest.

Secrets good practices

Sessions that survive identity removal

Removing a user in the identity provider does not end an active n8n session. The person can keep working until the session expires or is revoked, and an API key they created may still work. Define how long sessions last, include n8n removal in the offboarding runbook, and test that a disabled account is refused after a fresh login. Confirm session behavior with your n8n version before relying on it.

Drift between code and the running instance

A setting changed in the n8n interface, a manual patch to a live cluster or a stale chart version can leave the running instance different from what the repository describes. Reviews then check the wrong configuration. Enable the environment-managed SSO setting where it applies so the UI cannot override identity settings, run a scheduled comparison of deployed manifests against Git, and alert on any change made outside the pipeline.

What buyers ask before configuring n8n SSO as code

What drives the cost and effort of configuring n8n SSO as code?

The main drivers are the identity provider's complexity, the number of n8n environments, whether queue mode is in use, and how the instance is deployed. A single OIDC or SAML connection to one provider is far smaller than a setup that spans staging and production, with group-based role mapping, locked UI settings and tested break-glass access. Queue mode adds work because the encryption key must be shared with every worker and webhook processor, so each process needs the same secret delivered consistently. A Helm chart and a Compose file also differ in how secrets and environment variables are injected. Testing and secret management often take more effort than the variables themselves. Ask any quote to itemize each of these areas separately.

Can an internal team configure n8n SSO as code without a partner?

Yes, a capable internal team can do this if it has the skills and time. It needs working knowledge of the identity provider's admin console, OIDC or SAML concepts such as redirect URLs, claims and groups, and Kubernetes or Docker secret handling. It also needs someone who understands n8n's environment variables and release notes well enough to test changes before rollout. Teams often underestimate the testing step, which means proving that a locked setting, a role mapping and a break-glass login all behave as intended. Confirm current variable names and plan requirements with n8n before you start, since the vendor documentation is the authoritative source.

What does the work need from our team before it starts?

Expect to provide administrative access to the identity provider so the application registration and group claims can be created and tested. You will also need test accounts in several groups that map to different n8n roles, so each mapping can be verified. Access to the secret store, such as the system used for Kubernetes Secrets or a vault, is needed so the encryption key and OIDC client secret can be injected without being written into files. A staging environment that mirrors production is strongly recommended. Finally, name an owner for break-glass access who can sign in with a local account if the identity provider fails, and agree who approves changes to locked settings.

How long does configuring n8n SSO as code take?

The duration depends on scope, so it should be quoted from the written scope rather than estimated in general terms. The biggest variables are the number of identity providers, the number of environments, the complexity of group-to-role mapping, and whether queue mode and multiple environments must be covered. Testing and the approval of locked settings often take as long as the configuration itself. Ask for the schedule to list separate phases for design, staging validation, production cutover and handover, and ask what each phase depends on from your team, such as identity provider access and test accounts.

Which n8n plan includes SSO, and is OIDC included?

According to n8n's pricing page, SSO and LDAP are included only in the Business and Enterprise plans, so a Community edition instance does not include SSO. n8n's SAML single sign-on documentation covers the Business and Enterprise plans, with setup guides for Okta Workforce Identity and Azure AD. The supplied sources do not confirm whether OIDC is available on each plan, so confirm this with n8n directly before designing the configuration. Ask for the current feature list for the specific edition you plan to buy, and get the answer in writing.

What happens to SSO settings after an n8n upgrade?

Settings can change between releases, so an upgrade should always include a review of environment variable names, defaults and deprecated options. Read the release notes for each version between your current and target release, check that variables such as those controlling SSO management and OIDC still behave as expected, and retest sign-in in staging before production. n8n uses semantic versioning and ships minor releases roughly weekly, so a regular review cadence helps. Confirm specific variable changes with n8n in the release notes for the version you are moving to, and keep the configuration in version control so changes are visible and reversible.

Limits to confirm in your environment

Several limits decide whether a config-as-code design works on your n8n version, plan and topology. Confirm each one before you write the variables or chart values, because a wrong assumption here changes the build sequence. The cards below cover edition, version, chart support, queue mode, identity provider limits and high availability scope.

Plan that includes SSO and LDAP

SSO and LDAP are included only in the Business and Enterprise plans, according to n8n's pricing page. Community edition users cannot use the SSO settings this design depends on, so the edition decision comes first. Ask n8n in writing which plan covers SAML and OIDC for your deployment model, and whether the Business plan's self-hosted availability applies to your organization. Record that answer with the quote, since it defines what the configuration can contain.

n8n pricing

Variable names for your n8n version

Confirm that N8N_SSO_MANAGED_BY_ENV and the OIDC variables you plan to set exist in the exact n8n version you will run. Names and behavior can change between releases, and a variable that is silently ignored leaves the UI settings open. Ask n8n for the variable reference for that version and test on a non-production instance before you pin the image tag.

Helm chart support for each setting

A chart may not expose every environment variable or secret reference you need. Before you commit to a values file, ask the chart maintainers which identity, encryption key and locked-setting variables the chart passes through, and whether secrets can be injected from an existing Kubernetes Secret. If a setting is missing, you will need a Compose file, a custom overlay or a patch, and that work belongs in the estimate.

Queue mode and shared keys

In queue mode, workers and webhook processors need the main instance's encryption key so they can read stored credentials. Identity settings must also match on every process that serves login or webhooks. Confirm which processes your topology runs, where each secret is mounted and how a key rotation would reach every node. Missing a single worker can cause failed executions that look unrelated to identity.

Queue mode docs

Identity provider token and claim limits

Your identity provider sets its own limits on group claim size, token lifetime and attribute release. Large group memberships can truncate claims or hit header limits, and a short token lifetime can force frequent re-authentication for automated sessions. Ask the provider administrator for the claim size limit, the group claim format and the session and refresh lifetimes, then test with a user who belongs to many groups.

Multi-main high availability scope

Multi-main setup, which runs several main instances for high availability, is restricted to Enterprise self-hosted deployments and is not available in Community edition or n8n Cloud. If your design assumes a highly available login path, confirm the license tier in writing before you draw the architecture. Without it, plan for a single main instance with documented recovery steps, and keep the identity configuration in version control so it can be reapplied quickly.

How DeployOpen scopes, delivers and supports n8n identity configuration

DeployOpen treats n8n identity settings as infrastructure code that the client's own team can review and rerun. We scope the sign-in path, the role model and the locked settings in writing, build them from environment variables or a Helm chart or Compose file in the client's infrastructure, and hand over the repository with the evidence their security and compliance teams need.

How we scope

  • Engagements are fixed-scope, with the identity provider, plan edition and deployment method agreed in writing first.
  • The written scope lists which settings are managed by environment variables and which stay in the admin interface.
  • Scope names the break-glass owner account, the test users and the sign-in paths that must stay available during rollout.
  • Confirm with the vendor which SSO features your plan includes before the scope is signed.

How we build

  • We keep identity and policy settings in version-controlled files, reviewed like any other change to production.
  • Configuration is built for the chosen Helm chart or Compose file, with secrets supplied from your existing secret store.
  • We test sign-in with a staging instance, including denied access for users outside the permitted groups.
  • Each locked UI control is checked in the running instance so changes made in the interface cannot override the code.

How we hand over

  • You receive the configuration repository, a runbook for rotating the OIDC client secret, and a list of every environment variable set.
  • Documentation records which settings are locked, why, and who approves a change to them.
  • Handover includes a walkthrough with your identity, platform and security engineers on rebuilding the instance from code.
  • Evidence of configuration state is delivered in a form your auditors can sample, without us issuing any attestation.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers, scoped separately from the build.
  • Upgrades to new n8n releases are retested against the sign-in flow and locked settings before rollout.
  • Retainers can cover periodic reviews of group mappings, so access follows changes in your identity provider.
  • Ask any provider how they handle n8n version changes to these environment variable names before you sign.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.