Add TOTP Two-Factor Login to ownCloud Infinite Scale with Keycloak

ownCloud Infinite Scale does not provide a standalone 2FA switch in its user interface. For time-based one-time passwords (TOTP), configure an OpenID Connect identity provider such as Keycloak, require users to enroll an authenticator there, and let it challenge users during login. Infinite Scale’s own MFA settings are for step-up checks on protected routes; they do not create an OTP enrollment flow.

This guide uses Keycloak as the example identity provider. The exact menu labels can vary by Keycloak release. The screenshots below are interface illustrations, not captures of a tested server. ownCloud’s current 8.2 documentation lists OCIS_MFA_ENABLED and OCIS_MFA_AUTH_LEVEL_NAMES for route-level enforcement, introduced in Infinite Scale 7.3.0.

Choose the right enforcement model

First decide whether people should enter a second factor at every new sign-in or only when they reach a sensitive part of the service. Keycloak can require TOTP in its browser authentication flow. Infinite Scale can request step-up authentication for selected routes using the OIDC Authentication Context Class Reference (ACR) claim. They solve related but different problems.

ApproachGood fitTrade-off
Keycloak TOTP at sign-inOrganizations that want a second factor for browser loginsUsers need an authenticator app and a recovery plan; existing sessions may remain valid until they expire or users sign in again.
Infinite Scale step-up MFATeams protecting selected routes or data actionsRequires an IdP that supports step-up authentication and ACR claims, plus matching configuration on both sides.
WebAuthn security key or passkeyTeams prioritizing phishing-resistant authenticationEnrollment, device support, and account recovery need planning; this is a different second-factor choice from TOTP.

For a straightforward TOTP rollout, start with Keycloak’s browser login flow. Keep step-up MFA as a separate, deliberate policy when you need route-specific checks. See the ownCloud proxy documentation on ACR and step-up authentication for the server-side behavior.

Before you change the login flow

  • Confirm that Infinite Scale already redirects sign-ins to Keycloak through OIDC. Set up and test the identity-provider connection first; MFA will not repair a broken SSO integration.
  • Use HTTPS for both public sign-in endpoints, keep Keycloak’s host clock synchronized, and confirm administrators can still reach the Keycloak console.
  • Choose the enrollment method and communicate a recovery path before enforcing the second factor. Pilot with a test account and a small group.

Enable TOTP enrollment in Keycloak

  1. Set the OTP policy. In the correct realm, open Authentication and the OTP policy settings. Choose a time-based OTP policy. Keep the configured algorithm, code length, and period compatible with the authenticator apps your organization supports. TOTP codes expire quickly, so device clock drift can cause failed attempts.

Illustrative Keycloak Authentication page showing a time-based OTP policy with algorithm, digit count, look-ahead window, and period settings

Illustration: Keycloak’s OTP policy settings for time-based codes. Check your realm’s actual values before enrolling users.

  1. Enable Configure OTP. In Authentication > Required actions, make sure Configure OTP is enabled. Turning on its default action can prompt newly created users to enroll. It does not automatically assign the action to every existing account.
  2. Enroll existing users before broad enforcement. Assign the Configure OTP required action to pilot users or ask them to enroll through the account console, then confirm each can complete a fresh sign-in. For a wider rollout, plan how remaining users will be prompted and how support staff will restore access if a device is lost.

Illustrative Keycloak Required actions table with Configure OTP enabled and selected as a default action for new users

Illustration: Configure OTP is enabled as a required action and default action; existing users still need an enrollment plan.

Require the second factor in the browser flow

  1. Copy the built-in Browser flow. In Keycloak’s Authentication > Flows area, duplicate the built-in Browser flow and edit the copy. Keeping a copy gives you a safer path to compare and roll back the policy.
  2. Require OTP for the pilot. In the copied flow, configure the conditional 2FA sub-flow and OTP Form so users cannot complete password-based browser authentication without the second-factor step. Keycloak’s current administration guide describes requiring OTP in the conditional flow; an account without an OTP credential is prompted to set one up. Bind the copied flow as the realm’s Browser flow only after a pilot succeeds.
  3. Test a new sign-in. Use a private browser window so an existing SSO cookie does not hide the prompt. Sign in with the test account, scan the setup QR code with an authenticator app, enter a current code, and then sign out and sign in again. Confirm that a password alone no longer completes the browser login.

Illustrative Keycloak Browser flow with the conditional 2FA sub-flow and OTP Form marked Required

Illustration: a browser flow that requires OTP. Roll it out only after enrollment and recovery have been tested.

Keycloak’s default browser flow can behave conditionally: users who have not enrolled a second factor may not see an OTP challenge unless the flow is changed. Review the Keycloak Server Administration Guide before changing flow requirements, especially if you also use identity brokering, passkeys, desktop clients, or mobile clients.

Optional: ask Infinite Scale for step-up MFA on selected routes

For route-level checks, configure the proxy and frontend with matching MFA settings. In a deployment configuration that accepts environment variables, the current 8.2 names include:

OCIS_MFA_ENABLED: "true"
OCIS_MFA_AUTH_LEVEL_NAMES: "advanced"

Use the same accepted ACR value that your identity provider places in the access token after successful MFA. Configure the intended protected paths according to the proxy and frontend deployment documentation, then redeploy the affected services. This setting is disabled by default and does not, by itself, turn on TOTP or enforce OTP for every login. If a user reaches a protected route without the required MFA level, Infinite Scale documents a 403 response with an X-OCIS-MFA-Required header. See the ownCloud MFA environment-variable reference and the proxy service configuration.

Illustrative ownCloud Infinite Scale deployment configuration showing MFA enabled and an accepted ACR authentication level

Illustration: the current plural environment variable name for accepted MFA authentication levels; its value must match the IdP’s ACR claim.

Verify the rollout and preserve recovery access

Test the policy with a normal user, a user who has not enrolled, an administrator, and any desktop or mobile client your organization depends on. Confirm that a fresh browser login asks for TOTP and that a valid code succeeds. For step-up, request a protected route with a session that has not completed MFA, then confirm the IdP challenge occurs and the route works after the required ACR level is issued.

Keep an administrator recovery procedure available before requiring OTP across the realm. Document how to reset a lost authenticator, maintain access to the identity-provider console, and avoid relying on one person’s phone as the only path back into the service. TOTP is widely supported and easy to deploy, while WebAuthn can offer stronger phishing resistance; choose based on the devices, support capacity, and recovery controls your users actually have. The ownCloud knowledge base identifies Keycloak as an option for Infinite Scale 2FA.

Leave a Comment

Restore ownCloud Sync by Matching the Client to Your Server

Check whether the issue is an OC10 and 7.x compatibility break or a damaged CSync journal, then apply the right fix without deleting synced files.

Put ownCloud on HTTPS with Let’s Encrypt and Nginx

Put ownCloud on HTTPS with Let’s Encrypt and Nginx

Choose HTTP-01 or DNS-01, configure an ownCloud reverse proxy, and verify Certbot renews HTTPS certificates automatically.

Connect ownCloud Infinite Scale to LDAP for User Sign-In

Configure oCIS LDAP sign-in, align user and group lookups, and verify TLS and schema settings before rollout.

Connect an S3 Bucket to ownCloud 10 as External Storage

Connect an S3 Bucket to ownCloud 10 as External Storage

Add an Amazon S3 bucket to ownCloud 10, prepare compatible credentials and endpoints, and check access without confusing a mount with primary storage.

Automate ownCloud Database Dumps with a Safe Nightly Cron Job

Automate ownCloud Database Dumps with a Safe Nightly Cron Job

Schedule protected MariaDB dumps for ownCloud Server, handle maintenance mode safely, and verify each backup before relying on it.

Move ownCloud Classic to oCIS with a Supported Migration

Plan an ownCloud 10 to oCIS migration with the supported app, ordered commands, identity checks, and a clear list of data that needs separate handling.

Brand ownCloud Classic 10 with a Theme App and CSS

Replace ownCloud Classic 10 logos and tune web UI colors with a theme app, while avoiding upgrade and integrity-check pitfalls.

Set Default Storage Quotas by User Role in ownCloud oCIS

Set Default Storage Quotas by User Role in ownCloud oCIS

Assign byte-based storage limits to new ownCloud Infinite Scale users by role, with a proxy.yaml example and a safe verification checklist.

Fix ownCloud Sync Certificate Errors at the TLS Source

Fix ownCloud Sync Certificate Errors at the TLS Source

Restore ownCloud desktop syncing by checking the server hostname, certificate chain, private CA trust, and captive portal issues without disabling TLS verification.

Clear an ownCloud Integrity Warning After an Upgrade

Use the invalid-file report to identify mismatched core files or app signatures, restore the correct release files, and verify the integrity check safely.