|
| 1 | +#JIT (Just-In-Time) Provisioning with Entra ID (Azure AD) |
| 2 | + |
| 3 | +This guide explains how to set up JIT user provisioning with Microsoft Entra ID (formerly Azure AD) for Lowcoder. |
| 4 | + |
| 5 | +##Overview |
| 6 | + |
| 7 | +**JIT Provisioning** automatically creates user accounts in Lowcoder when users authenticate via SSO for the first time. This eliminates the need for manual user creation or SCIM provisioning for basic SSO scenarios. |
| 8 | + |
| 9 | +##How It Works |
| 10 | + |
| 11 | +1. User clicks**"Sign in with Entra ID"** on Lowcoder login page |
| 12 | +2. User authenticates with Microsoft Entra ID |
| 13 | +3. Entra ID redirects back to Lowcoder with authentication details |
| 14 | +4. Lowcoder automatically: |
| 15 | +- Creates a new user account (if doesn't exist) |
| 16 | +- Sets up the correct auth connection (Entra ID, not EMAIL) |
| 17 | +- Adds user to the organization |
| 18 | +- Logs user in |
| 19 | + |
| 20 | +##Prerequisites |
| 21 | + |
| 22 | +- Lowcoder instance running (self-hosted or cloud) |
| 23 | +- Admin access to Lowcoder |
| 24 | +- Microsoft Entra ID (Azure AD) tenant |
| 25 | +- Admin access to Azure Portal |
| 26 | + |
| 27 | +##Step 1: Configure Application in Azure Portal |
| 28 | + |
| 29 | +###1.1 Register a New Application |
| 30 | + |
| 31 | +1. Go to[Azure Portal](https://portal.azure.com) |
| 32 | +2. Navigate to**Azure Active Directory** →**App registrations** |
| 33 | +3. Click**New registration** |
| 34 | +4. Configure: |
| 35 | +-**Name**:`Lowcoder SSO` |
| 36 | +-**Supported account types**: Choose based on your needs |
| 37 | +- Single tenant (most common for enterprise) |
| 38 | +- Multi-tenant (if needed) |
| 39 | +-**Redirect URI**: |
| 40 | +- Platform:`Web` |
| 41 | +- URI:`https://your-lowcoder-domain.com/api/auth/oauth2/callback` |
| 42 | +5. Click**Register** |
| 43 | + |
| 44 | +###1.2 Configure API Permissions |
| 45 | + |
| 46 | +1. In your app registration, go to**API permissions** |
| 47 | +2. Click**Add a permission** |
| 48 | +3. Select**Microsoft Graph** |
| 49 | +4. Choose**Delegated permissions** |
| 50 | +5. Add these permissions: |
| 51 | +-`openid` |
| 52 | +-`profile` |
| 53 | +-`email` |
| 54 | +-`User.Read` |
| 55 | +6. Click**Add permissions** |
| 56 | +7. Click**Grant admin consent** (if you have admin rights) |
| 57 | + |
| 58 | +###1.3 Create Client Secret |
| 59 | + |
| 60 | +1. Go to**Certificates & secrets** |
| 61 | +2. Click**New client secret** |
| 62 | +3. Description:`Lowcoder SSO Secret` |
| 63 | +4. Expires: Choose appropriate duration (12-24 months recommended) |
| 64 | +5. Click**Add** |
| 65 | +6.**IMPORTANT**: Copy the secret**Value** immediately (you won't see it again!) |
| 66 | + |
| 67 | +###1.4 Note Your Configuration Details |
| 68 | + |
| 69 | +From**Overview** page, note: |
| 70 | + |
| 71 | +-**Application (client) ID**:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
| 72 | +-**Directory (tenant) ID**:`xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx` |
| 73 | + |
| 74 | +##Step 2: Configure Entra ID Provider in Lowcoder |
| 75 | + |
| 76 | +###2.1 Access Admin Settings |
| 77 | + |
| 78 | +1. Log in to Lowcoder as**admin** |
| 79 | +2. Go to**Settings** →**Authentication** (or Admin panel) |
| 80 | +3. Click**Add Authentication Provider** |
| 81 | + |
| 82 | +###2.2 Configure Generic OAuth Provider |
| 83 | + |
| 84 | +Fill in the following details: |
| 85 | + |
| 86 | +| Field| Value| |
| 87 | +| --------------------------| ---------------------------------------------------------------------| |
| 88 | +|**Provider Name**|`Entra ID` or`Azure AD`| |
| 89 | +|**Auth Type**|`GENERIC` (Generic OAuth2)| |
| 90 | +|**Client ID**|`<Application (client) ID from Azure>`| |
| 91 | +|**Client Secret**|`<Client secret value from Azure>`| |
| 92 | +|**Authorization Endpoint**|`https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/authorize`| |
| 93 | +|**Token Endpoint**|`https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token`| |
| 94 | +|**User Info Endpoint**|`https://graph.microsoft.com/v1.0/me`| |
| 95 | +|**Scope**|`openid profile email User.Read`| |
| 96 | +|**Enable Registration**| ✅**TRUE** (This enables JIT provisioning!)| |
| 97 | + |
| 98 | +Replace`{tenant-id}` with your actual tenant ID. |
| 99 | + |
| 100 | +###2.3 Configure User Attribute Mappings |
| 101 | + |
| 102 | +Set up how Entra ID user attributes map to Lowcoder user fields: |
| 103 | + |
| 104 | +```json |
| 105 | +{ |
| 106 | +"uid":"id", |
| 107 | +"username":"userPrincipalName", |
| 108 | +"email":"mail", |
| 109 | +"avatar":"photo" |
| 110 | +} |
| 111 | +``` |
| 112 | + |
| 113 | +Or if email field is sometimes null: |
| 114 | + |
| 115 | +```json |
| 116 | +{ |
| 117 | +"uid":"id", |
| 118 | +"username":"userPrincipalName", |
| 119 | +"email":"userPrincipalName", |
| 120 | +"avatar":"photo" |
| 121 | +} |
| 122 | +``` |
| 123 | + |
| 124 | +###2.4 Save Configuration |
| 125 | + |
| 126 | +Click**Save** or**Enable** to activate the provider. |
| 127 | + |
| 128 | +##Step 3: Test JIT Provisioning |
| 129 | + |
| 130 | +###3.1 Test User Login |
| 131 | + |
| 132 | +1.**Log out** from Lowcoder (if logged in) |
| 133 | +2. Go to Lowcoder login page |
| 134 | +3. You should see**"Sign in with Entra ID"** button |
| 135 | +4. Click the button |
| 136 | +5. You'll be redirected to Microsoft login |
| 137 | +6. Enter credentials and authenticate |
| 138 | +7. You'll be redirected back to Lowcoder |
| 139 | +8.**User account is automatically created** ✅ |
| 140 | + |
| 141 | +###3.2 Verify User Creation |
| 142 | + |
| 143 | +As admin: |
| 144 | + |
| 145 | +1. Go to**Settings** →**Members** or**Users** |
| 146 | +2. You should see the newly created user |
| 147 | +3. Check user details: |
| 148 | +- Auth Source should be**"Entra ID"** (not EMAIL) |
| 149 | +- Email should match the Entra ID account |
| 150 | +- User should be active |
| 151 | + |
| 152 | +##SCIM + JIT Combined Approach (Optional) |
| 153 | + |
| 154 | +If you need both SCIM provisioning AND SSO authentication: |
| 155 | + |
| 156 | +###Use Case |
| 157 | + |
| 158 | +- SCIM pre-provisions users (for compliance/audit) |
| 159 | +- Users still authenticate via SSO |
| 160 | +- JIT adds auth connection on first login |
| 161 | + |
| 162 | +###How It Works with Updated Code |
| 163 | + |
| 164 | +The updated`createSCIMUserAndAddToOrg` endpoint now: |
| 165 | + |
| 166 | +1.**Creates a placeholder user** via SCIM (no auth connection) |
| 167 | +2.**On first SSO login**, JIT provisioning adds the Entra ID auth connection |
| 168 | +3.**Subsequent logins** work normally via SSO |
| 169 | + |
| 170 | +###Configure Entra ID SCIM Provisioning |
| 171 | + |
| 172 | +1. In Azure Portal, go to your**Enterprise Application** |
| 173 | +2. Navigate to**Provisioning** |
| 174 | +3. Set**Provisioning Mode**:`Automatic` |
| 175 | +4. Configure: |
| 176 | +-**Tenant URL**:`https://your-lowcoder-domain.com/api/v1/organizations/{orgId}/scim/users` |
| 177 | +-**Secret Token**: Your API token |
| 178 | +5.**Mappings**: Map Azure AD attributes to SCIM attributes |
| 179 | +6.**Save** and**Start Provisioning** |
| 180 | + |
| 181 | +##Troubleshooting |
| 182 | + |
| 183 | +###Issue: "Sign in with Entra ID" button doesn't appear |
| 184 | + |
| 185 | +**Solution**: |
| 186 | + |
| 187 | +- Verify the auth provider is**enabled** in settings |
| 188 | +- Check that`enableRegister` is set to`true` |
| 189 | +- Clear browser cache and reload |
| 190 | + |
| 191 | +###Issue: User login fails with "LOG_IN_SOURCE_NOT_SUPPORTED" |
| 192 | + |
| 193 | +**Solution**: |
| 194 | + |
| 195 | +- Verify Authorization, Token, and User Info endpoints are correct |
| 196 | +- Check that tenant ID is properly replaced in URLs |
| 197 | +- Verify client ID and secret are correct |
| 198 | + |
| 199 | +###Issue: User created but with wrong auth source (EMAIL instead of Entra ID) |
| 200 | + |
| 201 | +**Solution**: |
| 202 | + |
| 203 | +- This means SCIM endpoint was used with old code |
| 204 | +- With updated code, SCIM creates placeholder users |
| 205 | +- JIT adds correct auth connection on first SSO login |
| 206 | +- Rebuild Docker image with the fix |
| 207 | + |
| 208 | +###Issue: "EMAIL_PROVIDER_DISABLED" error |
| 209 | + |
| 210 | +**Solution**: |
| 211 | + |
| 212 | +- This error occurs if trying to create EMAIL-based users when EMAIL auth is disabled |
| 213 | +- Use SSO with JIT provisioning instead |
| 214 | +- Don't use the old SCIM implementation that creates EMAIL users |
| 215 | + |
| 216 | +##Security Considerations |
| 217 | + |
| 218 | +1.**Client Secret**: Store securely, rotate regularly |
| 219 | +2.**Redirect URI**: Must exactly match what's configured in Azure |
| 220 | +3.**Scope**: Request minimum permissions needed |
| 221 | +4.**Enable Registration**: Only enable if you want JIT provisioning |
| 222 | +5.**Organization**: Configure which organization new users join |
| 223 | + |
| 224 | +##Advanced Configuration |
| 225 | + |
| 226 | +###Multi-Organization Support |
| 227 | + |
| 228 | +If you have multiple organizations: |
| 229 | + |
| 230 | +- Configure separate OAuth providers per organization |
| 231 | +- Or use organization domains to auto-assign users |
| 232 | + |
| 233 | +###Custom User Roles |
| 234 | + |
| 235 | +To assign custom roles on JIT provisioning: |
| 236 | + |
| 237 | +- Modify`AuthenticationApiServiceImpl.onUserLogin()` |
| 238 | +- Add logic to check Entra ID groups/roles |
| 239 | +- Map to Lowcoder roles accordingly |
| 240 | + |
| 241 | +###Email Verification |
| 242 | + |
| 243 | +JIT-provisioned users are automatically verified since they authenticated via SSO. |
| 244 | + |
| 245 | +##Comparison: SCIM vs JIT |
| 246 | + |
| 247 | +| Feature| SCIM Provisioning| JIT Provisioning| |
| 248 | +| --------------------| ----------------------------| ----------------------| |
| 249 | +|**User Creation**| Pre-provisioned via SCIM| Created on first login| |
| 250 | +|**Setup Complexity**| High| Low| |
| 251 | +|**Auth Source**| EMAIL (with old code)| Correct SSO source| |
| 252 | +|**Works with SSO**| Requires fix| ✅ Native support| |
| 253 | +|**Audit Trail**| Full provisioning audit| Login-based audit| |
| 254 | +|**Use Case**| Compliance, pre-provisioning| Simple SSO| |
| 255 | + |
| 256 | +##Recommendation |
| 257 | + |
| 258 | +For most use cases:**Use JIT Provisioning** (simpler, works correctly with SSO) |
| 259 | + |
| 260 | +For compliance requirements:**Use SCIM + JIT Combined** (with updated code) |
| 261 | + |
| 262 | +##References |
| 263 | + |
| 264 | +-[Microsoft Entra ID OAuth2 Documentation](https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow) |
| 265 | +-[Lowcoder Authentication Documentation](../../../workspaces-and-teamwork/oauth/) |
| 266 | +-[Generic OAuth Provider Setup](../../../workspaces-and-teamwork/oauth/generic-oauth-provider.md) |