@salesforce/ui-bundle-template-feature-react-mfa 11.48.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
Terms of Use
|
|
2
|
+
|
|
3
|
+
Copyright 2026 Salesforce, Inc. All rights reserved.
|
|
4
|
+
|
|
5
|
+
These Terms of Use govern the download, installation, and/or use of this
|
|
6
|
+
software provided by Salesforce, Inc. ("Salesforce") (the "Software"), were
|
|
7
|
+
last updated on April 15, 2025, and constitute a legally binding
|
|
8
|
+
agreement between you and Salesforce. If you do not agree to these Terms of
|
|
9
|
+
Use, do not install or use the Software.
|
|
10
|
+
|
|
11
|
+
Salesforce grants you a worldwide, non-exclusive, no-charge, royalty-free
|
|
12
|
+
copyright license to reproduce, prepare derivative works of, publicly
|
|
13
|
+
display, publicly perform, sublicense, and distribute the Software and
|
|
14
|
+
derivative works subject to these Terms. These Terms shall be included in
|
|
15
|
+
all copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
Subject to the limited rights expressly granted hereunder, Salesforce
|
|
18
|
+
reserves all rights, title, and interest in and to all intellectual
|
|
19
|
+
property subsisting in the Software. No rights are granted to you hereunder
|
|
20
|
+
other than as expressly set forth herein. Users residing in countries on
|
|
21
|
+
the United States Office of Foreign Assets Control sanction list, or which
|
|
22
|
+
are otherwise subject to a US export embargo, may not use the Software.
|
|
23
|
+
|
|
24
|
+
Implementation of the Software may require development work, for which you
|
|
25
|
+
are responsible. The Software may contain bugs, errors and
|
|
26
|
+
incompatibilities and is made available on an AS IS basis without support,
|
|
27
|
+
updates, or service level commitments.
|
|
28
|
+
|
|
29
|
+
Salesforce reserves the right at any time to modify, suspend, or
|
|
30
|
+
discontinue, the Software (or any part thereof) with or without notice. You
|
|
31
|
+
agree that Salesforce shall not be liable to you or to any third party for
|
|
32
|
+
any modification, suspension, or discontinuance.
|
|
33
|
+
|
|
34
|
+
You agree to defend Salesforce against any claim, demand, suit or
|
|
35
|
+
proceeding made or brought against Salesforce by a third party arising out
|
|
36
|
+
of or accruing from (a) your use of the Software, and (b) any application
|
|
37
|
+
you develop with the Software that infringes any copyright, trademark,
|
|
38
|
+
trade secret, trade dress, patent, or other intellectual property right of
|
|
39
|
+
any person or defames any person or violates their rights of publicity or
|
|
40
|
+
privacy (each a "Claim Against Salesforce"), and will indemnify Salesforce
|
|
41
|
+
from any damages, attorney fees, and costs finally awarded against
|
|
42
|
+
Salesforce as a result of, or for any amounts paid by Salesforce under a
|
|
43
|
+
settlement approved by you in writing of, a Claim Against Salesforce,
|
|
44
|
+
provided Salesforce (x) promptly gives you written notice of the Claim
|
|
45
|
+
Against Salesforce, (y) gives you sole control of the defense and
|
|
46
|
+
settlement of the Claim Against Salesforce (except that you may not settle
|
|
47
|
+
any Claim Against Salesforce unless it unconditionally releases Salesforce
|
|
48
|
+
of all liability), and (z) gives you all reasonable assistance, at your
|
|
49
|
+
expense.
|
|
50
|
+
|
|
51
|
+
WITHOUT LIMITING THE GENERALITY OF THE FOREGOING, THE SOFTWARE IS NOT
|
|
52
|
+
SUPPORTED AND IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
53
|
+
IMPLIED. IN NO EVENT SHALL SALESFORCE HAVE ANY LIABILITY FOR ANY DAMAGES,
|
|
54
|
+
INCLUDING, BUT NOT LIMITED TO, DIRECT, INDIRECT, SPECIAL, INCIDENTAL,
|
|
55
|
+
PUNITIVE, OR CONSEQUENTIAL DAMAGES, OR DAMAGES BASED ON LOST PROFITS, DATA,
|
|
56
|
+
OR USE, IN CONNECTION WITH THE SOFTWARE, HOWEVER CAUSED AND WHETHER IN
|
|
57
|
+
CONTRACT, TORT, OR UNDER ANY OTHER THEORY OF LIABILITY, WHETHER OR NOT YOU
|
|
58
|
+
HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
|
|
59
|
+
|
|
60
|
+
These Terms of Use shall be governed exclusively by the internal laws of
|
|
61
|
+
the State of California, without regard to its conflicts of laws
|
|
62
|
+
rules. Each party hereby consents to the exclusive jurisdiction of the
|
|
63
|
+
state and federal courts located in San Francisco County, California to
|
|
64
|
+
adjudicate any dispute arising out of or relating to these Terms of Use and
|
|
65
|
+
the download, installation, and/or use of the Software. Except as expressly
|
|
66
|
+
stated herein, these Terms of Use constitute the entire agreement between
|
|
67
|
+
the parties, and supersede all prior and contemporaneous agreements,
|
|
68
|
+
proposals, or representations, written or oral, concerning their subject
|
|
69
|
+
matter. No modification, amendment, or waiver of any provision of these
|
|
70
|
+
Terms of Use shall be effective unless it is by an update to these Terms of
|
|
71
|
+
Use that Salesforce makes available, or is in writing and signed by the
|
|
72
|
+
party against whom the modification, amendment, or waiver is to be
|
|
73
|
+
asserted.
|
|
74
|
+
|
|
75
|
+
Data Privacy: Salesforce may collect, process, and store device,
|
|
76
|
+
system, and other information related to your use of the Software. This
|
|
77
|
+
information includes, but is not limited to, IP address, user metrics, and
|
|
78
|
+
other data ("Usage Data"). Salesforce may use Usage Data for analytics,
|
|
79
|
+
product development, and marketing purposes. You acknowledge that files
|
|
80
|
+
generated in conjunction with the Software may contain sensitive or
|
|
81
|
+
confidential data, and you are solely responsible for anonymizing and
|
|
82
|
+
protecting such data.
|
package/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# feature-react-mfa
|
|
2
|
+
|
|
3
|
+
Enable Multi-Factor Authentication (MFA) for React-based Experience Cloud sites.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
Deploys two permission sets that enable platform-handled MFA for community users:
|
|
8
|
+
|
|
9
|
+
| Permission Set | Permission | Purpose |
|
|
10
|
+
| ---------------------------- | ---------------- | --------------------------------------- |
|
|
11
|
+
| `MFA_Required_For_Community` | `ForceTwoFactor` | Enforces MFA challenge at login |
|
|
12
|
+
| `API_Enabled_For_Community` | `ApiEnabled` | Enables REST API access for React sites |
|
|
13
|
+
|
|
14
|
+
## How MFA works on Experience Sites
|
|
15
|
+
|
|
16
|
+
The Salesforce platform handles the entire MFA flow:
|
|
17
|
+
|
|
18
|
+
1. User logs in via the site login page
|
|
19
|
+
2. Platform detects `ForceTwoFactor` permission on the user
|
|
20
|
+
3. Platform renders an MFA challenge page (on the `vforcesite` domain)
|
|
21
|
+
4. User completes verification (TOTP, Authenticator, WebAuthn, SMS, or Email)
|
|
22
|
+
5. User is redirected to the React app, fully authenticated
|
|
23
|
+
|
|
24
|
+
**No custom React UI is needed.** The platform handles the challenge page rendering.
|
|
25
|
+
|
|
26
|
+
## Prerequisites
|
|
27
|
+
|
|
28
|
+
Before installing this feature, ensure the following are already in place:
|
|
29
|
+
|
|
30
|
+
| Prerequisite | Why |
|
|
31
|
+
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| **Experience Cloud site deployed and active** | MFA applies to community login — no site means no login flow to protect |
|
|
33
|
+
| **Customer Community or Customer Community Login license enabled** | Required for community user profiles — without it, user creation and profile deployment will fail |
|
|
34
|
+
| **Community users exist** (or will self-register) | Permission sets are assigned to community users; the site must have a community-enabled profile |
|
|
35
|
+
| **Network/Site published at least once** | The site must be reachable at its URL for login + MFA challenge to appear |
|
|
36
|
+
| **Target org accessible via `sf` CLI** | Deployment and assignment commands require CLI authentication |
|
|
37
|
+
|
|
38
|
+
> **Note:** This feature does NOT handle org setup, license provisioning, or Experience Cloud site creation. If these prerequisites are missing, deploy the base app template (e.g. `propertyrentalapp`) first, then enable the Community license in Setup > Feature Settings > Digital Experiences.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
### Via features-cli (recommended)
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npx @salesforce/ui-bundle-features install mfa --ui-bundle-dir <your-ui-bundle-name>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Via patches (build-time composition)
|
|
49
|
+
|
|
50
|
+
Add to your app's `patches.ts`:
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
dependencies: ["packages/template/feature/feature-react-mfa"];
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Post-Install Setup
|
|
57
|
+
|
|
58
|
+
After installing the permission set metadata:
|
|
59
|
+
|
|
60
|
+
1. **Deploy to your org:**
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
sf project deploy start --source-dir force-app/main/default/permissionsets \
|
|
64
|
+
--target-org <org-alias> --test-level NoTestRun --wait 10
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Or deploy and verify manually:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
sf project deploy start --source-dir force-app/main/default/permissionsets \
|
|
71
|
+
--target-org <org-alias> --test-level NoTestRun
|
|
72
|
+
|
|
73
|
+
# Wait for deployment to complete, then verify
|
|
74
|
+
sf project deploy report --target-org <org-alias>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
2. **Verify deployment succeeded:**
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
sf org list metadata --metadata-type PermissionSet --target-org <org-alias> | grep MFA
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
3. **Assign permission sets to community users:**
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
sf org assign permset --name MFA_Required_For_Community --target-org <org-alias>
|
|
87
|
+
sf org assign permset --name API_Enabled_For_Community --target-org <org-alias>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
4. **Publish the site:**
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
sf community publish --name "<site-name>" --target-org <org-alias>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
5. **Verify:** Open an incognito browser, navigate to the site, log in, and confirm the MFA challenge page appears.
|
|
97
|
+
|
|
98
|
+
6. **(Optional) Customize MFA/login page branding:**
|
|
99
|
+
For site containers, use the Setup UI (Administration → Branding) once the platform fix (W-23140888) ships. For headless LWR sites, deploy `NetworkBranding` metadata via Metadata API to customize logo, colors, and footer text on the platform-rendered MFA challenge page.
|
|
100
|
+
|
|
101
|
+
## Verification Methods
|
|
102
|
+
|
|
103
|
+
The platform supports these MFA verification methods (configured at the org level):
|
|
104
|
+
|
|
105
|
+
- Authenticator App (TOTP)
|
|
106
|
+
- Salesforce Authenticator
|
|
107
|
+
- WebAuthn Platform (Touch ID / Face ID)
|
|
108
|
+
- WebAuthn Roaming (Security Key)
|
|
109
|
+
- SMS
|
|
110
|
+
- Email OTP
|
|
111
|
+
|
|
112
|
+
## Troubleshooting
|
|
113
|
+
|
|
114
|
+
| Problem | Solution |
|
|
115
|
+
| ---------------------------------- | ------------------------------------------------------------------ |
|
|
116
|
+
| No MFA challenge appears | Verify `MFA_Required_For_Community` is assigned to the user |
|
|
117
|
+
| `API_DISABLED_FOR_ORG` after login | Assign `API_Enabled_For_Community` permission set |
|
|
118
|
+
| MFA page shows default branding | Deploy `NetworkBranding` metadata via Metadata API |
|
|
119
|
+
| `vforcesite` in MFA page URL | Expected behavior — platform serves MFA from Force.com Site domain |
|
|
120
|
+
|
|
121
|
+
## Emergency Rollback
|
|
122
|
+
|
|
123
|
+
If MFA breaks site login and locks out all community users, follow these steps to quickly disable MFA:
|
|
124
|
+
|
|
125
|
+
### Option 1: Remove Permission Set Assignments (Fastest)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
# List assignment record Ids for users with MFA permission set assigned
|
|
129
|
+
sf data query --query "SELECT Id, AssigneeId, Assignee.Username FROM PermissionSetAssignment WHERE PermissionSet.Name = 'MFA_Required_For_Community'" --target-org <org-alias>
|
|
130
|
+
|
|
131
|
+
# Remove the assignment for each affected user (sf org assign permset has no --unassign flag;
|
|
132
|
+
# deleting the PermissionSetAssignment record is the supported way to unassign)
|
|
133
|
+
sf data delete record --sobject PermissionSetAssignment --record-id <assignment-id> --target-org <org-alias>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
For bulk removal, use Data Loader:
|
|
137
|
+
|
|
138
|
+
1. Export `PermissionSetAssignment` records where `PermissionSet.Name = 'MFA_Required_For_Community'`
|
|
139
|
+
2. Delete those records via Data Loader
|
|
140
|
+
|
|
141
|
+
### Option 2: Delete the Permission Set Metadata
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Delete from org
|
|
145
|
+
sf project delete source --metadata PermissionSet:MFA_Required_For_Community --target-org <org-alias> --no-prompt
|
|
146
|
+
|
|
147
|
+
# Remove from source (if needed)
|
|
148
|
+
rm -rf force-app/main/default/permissionsets/MFA_Required_For_Community.permissionset-meta.xml
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Prevention Checklist
|
|
152
|
+
|
|
153
|
+
Before deploying MFA to production:
|
|
154
|
+
|
|
155
|
+
- [ ] Verify at least one MFA verification method is enabled in Setup → Identity → Multi-Factor Authentication
|
|
156
|
+
- [ ] Test with a dedicated test community user (NOT your admin account)
|
|
157
|
+
- [ ] Ensure test user has registered an MFA verification method
|
|
158
|
+
- [ ] Document your rollback plan and share with team
|
|
159
|
+
- [ ] Have a System Admin ready to execute rollback if needed
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@salesforce/ui-bundle-template-feature-react-mfa",
|
|
3
|
+
"version": "11.48.0",
|
|
4
|
+
"description": "MFA enablement for React Experience Cloud sites",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
|
+
"author": "",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "index.js",
|
|
9
|
+
"files": [
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"clean": "rm -rf dist"
|
|
17
|
+
},
|
|
18
|
+
"nx": {
|
|
19
|
+
"targets": {
|
|
20
|
+
"build": {
|
|
21
|
+
"executor": "nx:run-commands",
|
|
22
|
+
"options": {
|
|
23
|
+
"command": "echo 'metadata-only, no build needed'",
|
|
24
|
+
"cwd": "packages/template/feature/feature-react-mfa"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"watch": {
|
|
28
|
+
"executor": "@salesforce/ui-bundle-template-cli:watch-patches"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
package/src/force-app/main/default/permissionsets/API_Enabled_For_Community.permissionset-meta.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
3
|
+
<label>API Enabled For Community</label>
|
|
4
|
+
<description>Grants API Enabled permission for community users on React-based Experience Sites. Required for sites that make REST or Connect API calls. Without this permission, post-login API calls return API_DISABLED_FOR_ORG.</description>
|
|
5
|
+
<hasActivationRequired>false</hasActivationRequired>
|
|
6
|
+
<userPermissions>
|
|
7
|
+
<enabled>true</enabled>
|
|
8
|
+
<name>ApiEnabled</name>
|
|
9
|
+
</userPermissions>
|
|
10
|
+
</PermissionSet>
|
package/src/force-app/main/default/permissionsets/MFA_Required_For_Community.permissionset-meta.xml
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
|
|
3
|
+
<label>MFA Required For Community</label>
|
|
4
|
+
<description>Enforces Multi-Factor Authentication at UI login for assigned Experience Site users. Assign to individual community users to require MFA on login.</description>
|
|
5
|
+
<hasActivationRequired>false</hasActivationRequired>
|
|
6
|
+
<userPermissions>
|
|
7
|
+
<enabled>true</enabled>
|
|
8
|
+
<name>ForceTwoFactor</name>
|
|
9
|
+
</userPermissions>
|
|
10
|
+
</PermissionSet>
|