Download the PHP package restruct/silverstripe-mfa-bundle without Composer

On this page you can find all versions of the php package restruct/silverstripe-mfa-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package silverstripe-mfa-bundle

Silverstripe MFA Bundle

Portable MFA bundle for Silverstripe 5 with TOTP (Google Authenticator) and WebAuthn (security keys/biometrics) support.

Quick Start

  1. composer require restruct/silverstripe-mfa-bundle
  2. Add SS_MFA_SECRET_KEY to .env, run dev/build

That's it. MFA is enforced with a 6-month grace period out of the box.

Features

Requirements

Installation

Configuration

1. Set encryption key (required)

Add to your .env:

Generate a key:

2. Configure TOTP settings (optional)

Create app/_config/mfa.yml:

3. Configure WebAuthn settings (optional)

By default, this bundle allows both platform authenticators (Touch ID, Windows Hello, Face ID) and cross-platform authenticators (USB security keys). You can restrict this:

Note: WebAuthn requires HTTPS and a supported browser (Chrome, Firefox, Safari, Edge).

4. MFA requirement (enabled by default)

This bundle automatically enables "MFA Required" on first dev/build and hides the SiteConfig MFA settings. Users will be prompted to set up MFA on their next login.

A grace period of 6 months is set by default, allowing users to skip MFA setup temporarily. After the grace period expires, MFA becomes mandatory.

To show the MFA settings in SiteConfig (for manual control):

5. Disable during development (optional)

Add to .env:

Configuration Reference

Bundle settings

Class Setting Default Description
SiteConfigMFAExtension grace_period_days 180 Days users can skip MFA (0 = no grace period)
SiteConfigMFAExtension show_mfa_settings false Show MFA fields in SiteConfig
TOTPConfigExtension issuer SiteConfig Title App name shown in authenticator
TOTPConfigExtension period 30 Seconds per code
TOTPConfigExtension algorithm sha1 Hash algorithm (sha1/sha256/sha512)

SilverStripe TOTP settings (set directly on SS classes)

Setting Class Default Description
code_length Method 6 Number of digits (6-8)
secret_length RegisterHandler 16 Secret key length

SilverStripe WebAuthn settings (set directly on SS classes)

Setting Class Default Description
authenticator_attachment RegisterHandler null* Allowed authenticator types

*This bundle sets the default to null (allow both). SilverStripe's default is cross-platform (security keys only).

Help link settings (set by this bundle)

Class Setting Default
SilverStripe\TOTP\RegisterHandler user_help_link /mfa-help/totp
SilverStripe\WebAuthn\RegisterHandler user_help_link /mfa-help/webauthn
SilverStripe\MFA\Authenticator\LoginHandler user_help_link /mfa-help/
SilverStripe\MFA\BackupCode\RegisterHandler user_help_link /mfa-help/backup-codes

Override these if you use a custom URL segment or external help pages.

Authenticator attachment options:

MFA enforcement

Setting Class Default Description
required_mfa_methods EnforcementManager 1 Minimum methods required

How it works

TOTP (Authenticator App)

  1. A secret is generated and encrypted with SS_MFA_SECRET_KEY
  2. The QR code shows your configured issuer name
  3. User scans with Google Authenticator, Authy, 1Password, etc.
  4. On login, user enters the 6-digit code from their app

WebAuthn (Security Key / Biometrics)

  1. User registers their authenticator (USB key, Touch ID, etc.)
  2. A credential is stored, tied to your domain
  3. On login, user taps their key or uses biometrics

Note: WebAuthn credentials are domain-specific. Not recommended with silverstripe/subsites as each subsite domain would need separate credentials.

Admin Management

Resetting user MFA

Admins with the MFA_ADMINISTER_REGISTERED_METHODS permission can manage MFA for other users:

  1. Go to Security → Users and edit a user
  2. Find the Registered MFA Methods GridField (only shown for users with MFA configured)
  3. Delete any MFA methods to force the user to re-register

When all MFA methods are removed, the user will be prompted to set up MFA again on their next login.

Note: This GridField only appears when viewing other users' accounts, not your own (use the standard MFA interface for self-management).

Alternative: Account Reset Email

SilverStripe MFA also includes a built-in "Send account reset email" button that sends the user a link to reset both their password and MFA settings. This is useful when you want the user to verify their identity via email.

Troubleshooting

"This method has not been configured yet"

The SS_MFA_SECRET_KEY environment variable is not set.

WebAuthn "Security key" option not showing

WebAuthn not working with Touch ID / Windows Hello

The default SilverStripe setting only allows USB security keys. This bundle changes it to allow both, but if you've overridden authenticator_attachment, ensure it's set to ~ (null) or 'platform'.

Testing locally

Use BYPASS_MFA=1 in .env to skip MFA during development.

Note: WebAuthn passkeys require a trusted HTTPS certificate. Self-signed certificates may cause registration to fail with Chrome's native passkey storage.

Understanding WebAuthn Authenticator Types

WebAuthn supports different authenticator types with different trade-offs:

Platform vs Cross-Platform

Type Examples Pros Cons
Platform Touch ID, Face ID, Windows Hello Free, built-in, convenient Tied to single device
Cross-platform YubiKey, USB/NFC security keys Portable, works anywhere Requires purchasing hardware

Passkeys (Synced Credentials)

Modern browsers support passkeys - WebAuthn credentials that sync across devices:

When a user registers WebAuthn with authenticator_attachment: ~ (both), the browser offers choices:

  1. This device (platform) - Touch ID/Face ID, may sync via iCloud/Google
  2. Security key (cross-platform) - USB/NFC hardware key
  3. Phone/tablet - Use another device via QR code

Users can register multiple authenticators for redundancy.

Recommendation

This bundle defaults to authenticator_attachment: ~ (allow both) for maximum flexibility. Users can choose based on their needs:

Help Pages

This bundle includes translatable help pages served at /mfa-help/:

URL Content
/mfa-help/ Overview of MFA
/mfa-help/totp Authenticator app setup
/mfa-help/webauthn Security key / biometrics setup
/mfa-help/backup-codes Backup codes explanation

Help pages automatically display in the logged-in user's CMS locale (from Member.Locale), falling back to the site's default locale. Translations are included for: English, Dutch, German, French, and Spanish.

Disabling Help Pages

To disable the built-in help pages entirely, set DISABLE_MFA_HELP as an environment variable or PHP constant:

Or in app/_config.php:

Changing the URL Segment

To serve help pages at a different URL (e.g., /hulp/):

  1. Disable the default route via DISABLE_MFA_HELP
  2. Configure your custom URL segment and Director rule:

  3. Update the help URLs to match your custom segment:

Customizing Help Content

Override the translations via lang files in your project, or point to your own URLs:

To disable help links entirely, set them to empty strings.

Further Reading

SilverStripe Documentation

WebAuthn Specifications

License

MIT


All versions of silverstripe-mfa-bundle with dependencies

PHP Build Version
Package Version
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package restruct/silverstripe-mfa-bundle contains the following files

Loading the files please wait ...