Skip to content

Commit 9361042

Browse files
committed
Implementing JWT with OAuth
1 parent b4c630b commit 9361042

File tree

45 files changed

+1232
-5979
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1232
-5979
lines changed

.forceignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ package.xml
1010

1111
# LWC Jest
1212
**/__tests__/**
13+
14+
**/flows**
15+
profiles
16+
profiles/Admin.profile-meta.xml
17+
force-app/main/default/certs

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,8 @@ $RECYCLE.BIN/
4646
**/venv/
4747

4848
# testing flows
49-
force-app/main/default/flows
49+
force-app/main/default/flows
50+
flow_scanner.crt
51+
flow_scanner.key
52+
flow_jwt_rsa.key
53+
sfdx-project.json

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ Since 2021, the _Lightning Flow Scanner_ has grown from its roots as VS Code Ext
44
- 📢 Sharing our work with your network
55
- 💬 Sharing feedback to help us improve
66
- 💻 Contributing code to drive innovation
7-
- 🤝 Join us as a member
7+
- 🤝 [Become a member](https://register.lightningflowscanner.org/) to stay connected.
88

99
Want to help improve Lightning Flow Scanner? See our [Contributing Guidelines](https://github.com/Flow-Scanner/lightning-flow-scanner-core/blob/main/CONTRIBUTING.md).

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ For details about all available rules, their default severities, and configurati
5050

5151
### User Manual
5252

53-
*Prerequisite: Ensure that the Flow Scanner permission set is assigned to users who need access.*
54-
5553
- Click on the App Launcher icon in the top-left corner of your Salesforce interface.
5654
- Search for "Flow Scanner" in the App Launcher.
5755
- Click on the "Flow Scanner" app to open the Scan Flows Overview.
@@ -84,15 +82,13 @@ While no configuration is required, Admins can define **default severities**, **
8482

8583
## Installation
8684

87-
<a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04tgK00000079xpQAA">
88-
<img alt="Install Managed Package" src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png">
89-
</a>
90-
91-
Or via Salesforce CLI:
85+
| Deployment Type | Installation |
86+
|-----------------|----------------|
87+
| **Managed** (Recommended) | <a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04tgK0000007M73QAE"><img alt="Install Managed Package" src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png"></a> |
88+
| **Unmanaged** | <a href="https://githubsfdeploy.herokuapp.com?owner=Flow-Scanner&repo=lightning-flow-scanner-app&ref=main"><img alt="Install Unmanaged Package" src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/deploy.png"></a> |
89+
| **Or via CLI** | `sf package install --package 04tgK0000007M73QAE --wait 10` |
9290

93-
```bash
94-
sf package install --package 04tgK00000079xpQAA --wait 10
95-
```
91+
> After installation, complete the [Post-Installation Setup](assets\docs\installation.md) to configure the Connected App and assign permissions.
9692
9793
---
9894

SECURITY.md

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,9 @@
33
## Security Practices
44

55
- Code is open-source and peer-reviewed by the community.
6-
- Vulnerabilities can be reported privately via GitHub security features.
6+
- Vulnerabilities can be reported privately via [GitHub vulnerability reporting](https://github.com/Flow-Scanner/lightning-flow-scanner-app/security).
77
- Changes to the repository are scanned and reviewed before merging.
88

9-
## Reporting a Vulnerability
10-
11-
If you discover a security vulnerability, please report it using [GitHub vulnerability reporting](https://github.com/Flow-Scanner/lightning-flow-scanner-app/security).
12-
139
## Data Handling
1410

1511
This tool collects zero user data. No credentials, PII, payment info, health data, or user content is ever stored, transmitted, or shared. All analysis runs 100% client-side with no network calls to external services.
@@ -23,6 +19,5 @@ We temporarily use metadata (e.g., Flow metadata, timestamps) in-memory only for
2319
We actively track and maintain an up-to-date inventory of all third-party dependencies to ensure security and compatibility. Our dependencies include:
2420

2521
- `lightning-flow-scanner-core` ([MIT license](https://github.com/Flow-Scanner/lightning-flow-scanner-core/blob/main/LICENSE.md)) – static analysis engine
26-
- `jsforce` ([MIT license](https://github.com/jsforce/jsforce/blob/main/LICENSE)) – Salesforce API connector
2722

2823
These dependencies are packaged as static resources.

config/project-scratch-def.json

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
{
22
"orgName": "LightningFlowScanner",
33
"edition": "Developer",
4-
"features": ["EnableSetPasswordInApi"],
4+
"features": [
5+
"API",
6+
"AddCustomApps:10",
7+
"AddCustomTabs:30",
8+
"EnableSetPasswordInApi",
9+
"AuthorApex",
10+
"DebugApex"
11+
],
512
"settings": {
613
"lightningExperienceSettings": {
714
"enableS1DesktopEnabled": true
@@ -11,8 +18,14 @@
1118
},
1219
"securitySettings": {
1320
"sessionSettings": {
14-
"lockerServiceNext": true
15-
}
16-
}
21+
"lockerServiceNext": true
22+
}
23+
},
24+
"apexSettings": {
25+
"enableCompileOnDeploy": true
26+
},
27+
"oauthOidcSettings": {
28+
"blockOAuthUnPwFlow": false
29+
}
1730
}
18-
}
31+
}

docs/installation.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
## Post-Installation Setup (takes ~3–5 minutes)
2+
3+
To enable server-to-server authentication for your application using JWT Bearer Flow, follow these steps to manually create and configure a Connected App with a self-signed certificate.
4+
5+
### Step 1 – Create the Connected App
6+
1. Go to **Setup → App Manager → New Connected App**.
7+
2. Fill in the basic info:
8+
- **Connected App Name**: `Flow Scanner JWT`
9+
- **API Name**: `Flow_Scanner_JWT` (auto-populates based on the name)
10+
- **Contact Email**: your email address
11+
3. Under **API (Enable OAuth Settings)**:
12+
- Check **Enable OAuth Settings**
13+
- **Callback URL**: `https://login.salesforce.com/services/oauth2/success` (placeholder; not used in JWT flow but required)
14+
- Check **Use digital signatures**
15+
- **Require Secret for Web Server Flow**: Uncheck (if visible)but we
16+
- **Require Secret for Refresh Token Flow**: Uncheck
17+
- **Enable Client Credential Flow**: Uncheck
18+
- **Enable Authorization Code Flow**: Uncheck
19+
- **Require PKCE**: Uncheck
20+
- **Enable Token Exchange Flow**: Uncheck
21+
- **Selected OAuth Scopes**: Add `Access and manage your data (api)` and `Perform requests on your behalf at any time (refresh_token, offline_access)`
22+
- Uncheck other options like **Enable Named User JWT Flow**, **Introspect All Tokens**, **Refresh Token Rotation**, **Secret Required for Token Exchange**
23+
4. Under **OAuth Policies**:
24+
- **IP Relaxation**: `Relax IP restrictions`
25+
- **Refresh Token Policy**: `Refresh token is valid until revoked`
26+
5. Click **Save** (it may take a few minutes for the app to be created).
27+
28+
### Step 2 – Create & Upload the Certificate (45 seconds)
29+
1. Go to **Setup → Certificate and Key Management**.
30+
2. Click **Create Self-Signed Certificate**.
31+
3. Fill in:
32+
- **Label**: `Flow Scanner`
33+
- **Unique Name**: `Flow_Scanner`**must be exactly this**
34+
- Key Size: 2048 or higher
35+
4. Click **Save**.
36+
5. Download the certificate (`.crt` file).
37+
6. Go to **App Manager → Flow Scanner JWT → Manage → Edit**.
38+
7. Under **Use digital signatures**, click **Upload Certificate**.
39+
8. Upload the `.crt` file → **Save**.
40+
41+
### Step 3 – Copy & Paste the Consumer Key (30 seconds)
42+
1. In **App Manager → Flow Scanner JWT → View**.
43+
2. Click **Manage Consumer Details** (verify identity once).
44+
3. **Copy the Consumer Key** (starts with `3MVG…`).
45+
4. Go to **Setup → Custom Metadata Types → Flow Scanner OAuth Config → Manage Records**.
46+
5. Edit (or create) the record with **Developer Name = `Default`**.
47+
6. Paste into the **Consumer Key** field → **Save**.
48+
49+
### Step 4 – Pre-Authorize the Connected App (optional, to avoid consent screen)
50+
1. In **App Manager → Flow Scanner JWT → Manage → Edit Policies**.
51+
2. Set **Permitted Users** to **Admin approved users are pre-authorized****Save**.
52+
3. Scroll to **Profiles** section → **Manage Profiles**.
53+
4. Check **System Administrator** (or relevant profiles) → **Save**.
54+
- This allows users with those profiles to use the app without prompts. If you need more granularity, create a custom (unmanaged) Permission Set and assign it here instead.
55+
56+
### Step 5 – Assign the Permission Set
57+
1. Go to **Setup → Permission Sets → Flow Scanner User**.
58+
2. Click **Manage Assignments** → add your users → **Done**.
59+
60+
**The app is now ready to use!** Assigned users can run Flow Scanner features, and JWT authentication will handle Tooling API calls seamlessly.

force-app/main/default/applications/LFSApp.app-meta.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66
<logoVersion>1</logoVersion>
77
<shouldOverrideOrgTheme>false</shouldOverrideOrgTheme>
88
</brand>
9-
<description>Lightning Flow Scanner</description>
9+
<description>Flow Scanner</description>
1010
<formFactors>Small</formFactors>
1111
<formFactors>Large</formFactors>
1212
<isNavAutoTempTabsDisabled>true</isNavAutoTempTabsDisabled>
1313
<isNavPersonalizationDisabled>true</isNavPersonalizationDisabled>
14+
<isNavTabPersistenceDisabled>false</isNavTabPersistenceDisabled>
15+
<isOmniPinnedViewEnabled>false</isOmniPinnedViewEnabled>
1416
<label>Flow Scanner</label>
1517
<navType>Standard</navType>
1618
<tabs>Lightning_Flow_Scanner</tabs>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<aura:application access="GLOBAL" extends="ltng:outApp">
22
<aura:dependency resource="c:lightningFlowScannerApp" />
3-
</aura:application>
3+
</aura:application>

force-app/main/default/aura/LFS_App/LFS_App.app-meta.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
<AuraDefinitionBundle xmlns="http://soap.sforce.com/2006/04/metadata">
33
<apiVersion>58.0</apiVersion>
44
<description>A Lightning Application Bundle</description>
5-
</AuraDefinitionBundle>
5+
</AuraDefinitionBundle>

0 commit comments

Comments
 (0)