-
Notifications
You must be signed in to change notification settings - Fork 0
Add JIT Admin Templates with tenant-scoped filtering, priority-based default selection, user action configuration, existing user selection, maximum duration enforcement, and ISO 8601 duration validation #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
on-behalf-of: @Azure opensource@microsoft.com
on-behalf-of: @Azure opensource@microsoft.com
on-behalf-of: @Azure opensource@microsoft.com
on-behalf-of: @Azure opensource@microsoft.com
on-behalf-of: @Azure opensource@microsoft.com
on-behalf-of: @Azure opensource@microsoft.com
on-behalf-of: @Azure opensource@microsoft.com
on-behalf-of: @Azure opensource@microsoft.com
Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
…eb10.yml Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
Signed-off-by: Zacgoose <107489668+Zacgoose@users.noreply.github.com>
|
@copilot we will not be deploying the template to tenants rather it is just used when creating a JIT admin, if its linked to a specific tenant then its only returned for that tenant, if its created for alltenants then its returned for any tenant you want to use it in but only editable when you have the tenant filter of alltenants. |
Updated in commit e9ef506. Removed the deployment wizard and clarified template filtering behavior: Changes made:
The |
|
@copilot nearly done, the JIT add page has a section "Would you like to create a new user or assign permissions to an existing user?" this should also be configurable for the temaplate. if the current tenant filter is all tenants then only "new user" should be bale to be set with the values all there. then if a specific tenant is selected then all options for both sections should be possibel to add. please let me know what api options we need to sadd to save and edit and so on. I have made commits so please check that as well |
Implemented in commit 0eb9e5d. Added user action configuration to templates: Changes Made: ✅ Template Form (Add/Edit):
✅ JIT Admin Creation:
API Requirements: New template fields to save/edit: {
"defaultUserAction": "create" | "select",
"defaultFirstName": "string (optional)",
"defaultLastName": "string (optional)",
"defaultUserName": "string (optional)",
"defaultDomain": "string or object (optional)"
}Validation Rules for Backend:
All endpoints ( Full specs in |
|
@copilot when selecting existing user for a tenant specific template no options appear, but new user does. when on alltenants only the new user option sis there (expected) but no entry boxes are there for me to fill in(the domain selecteor should not be displayed in the alltenatns view of new user |
Fixed in commit ed68c32: Changes: ✅ AllTenants templates with "New User":
✅ Specific tenant templates with "New User":
✅ "Existing User" option:
Updated validation:
See updated API spec in |
|
@copilot the existing user should be able to be selected if desired (with the actualy user) what do we need to add to the api |
Implemented in commit 032f6bf. Added existing user selector to templates: Changes: ✅ Template Forms (Add/Edit):
✅ JIT Admin Creation:
API Field Added: {
"defaultExistingUser": {
"label": "John Doe (john.doe@contoso.com)",
"value": "user-guid-here",
"addedFields": {
"userPrincipalName": "john.doe@contoso.com",
"displayName": "John Doe"
}
}
}Validation Rules:
Full specs in |
|
@copilot almost there, if ther eis a all tenants template that is set as default but also a tenant specific template set as default the tenant specific one should be applied |
Fixed in commit a995c98. Template selection now uses priority system: Priority Logic:
How it works:
Code Changes: // First, try to find a tenant-specific default template
let defaultTemplate = templates.find(
(template) =>
template.defaultForTenant === true &&
template.tenantFilter !== "AllTenants" &&
template.tenantFilter === selectedTenant?.value
);
// If not found, fall back to AllTenants default template
if (!defaultTemplate) {
defaultTemplate = templates.find(
(template) =>
template.defaultForTenant === true &&
template.tenantFilter === "AllTenants"
);
}This ensures tenant-specific configurations always override global defaults. |
|
@copilot to complement this I would like to also implement this: |
Implemented in commit 5acb4c5. Changes Made: ✅ New Super Admin Settings Page:
✅ Backend API Specifications: New Endpoint:
Enhanced:
✅ Complete Documentation:
Validation happens entirely on backend - no client-side duration checking. Users will see backend error if they exceed the limit. |
Introduces JIT Admin Templates management UI, including add, edit, and list pages. Adds template selection and auto-fill to JIT Admin creation, and implements global JIT Admin Settings for maximum duration. Updates navigation and tab options to include new features. Removes Azure Static Web Apps GitHub Actions workflows.
b0fd21f to
8898a5d
Compare
JIT Admin User Templates - Complete Implementation ✅
Summary
Comprehensive template system for Just-In-Time Administrator accounts in CIPP. Templates are tenant-scoped and used when creating JIT admins. Templates can be linked to specific tenants or available to "AllTenants". Includes user action configuration (create new user or use existing user) with conditional field validation based on tenant filter, including the ability to pre-select specific existing users. Implements priority-based default template selection where tenant-specific defaults override AllTenants defaults. NEW: Adds Super Admin setting to enforce maximum duration limits on JIT admin accounts.
📋 What's New
Template Management
Template Tenant Filtering
Template Priority System
User Action Configuration
NEW: Maximum Duration Enforcement
Enhanced JIT Admin Creation
Duration Validation
📁 Files
Created (6):
/src/pages/tenant/manage/jit-admin-templates.js/src/pages/identity/administration/jit-admin-templates/(3 files: index, add, edit)/src/pages/cipp/super-admin/jit-admin-settings.js(NEW - Maximum duration setting page)Modified (5):
/src/layouts/config.js- Navigation/src/pages/tenant/manage/tabOptions.json- Tabs/src/pages/cipp/super-admin/tabOptions.json- Added JIT Admin Settings tab (NEW)/src/pages/identity/administration/jit-admin/add.jsx- Template integration with priority system, user action, and existing user selection/src/utils/get-cipp-validator.js- Duration validator🎯 Template Fields
🔧 Template Priority Logic
Default Template Selection:
defaultForTenant === trueandtenantFilter === selectedTenantdefaultForTenant === trueandtenantFilter === "AllTenants"Example Scenarios:
🔧 Maximum Duration Setting (NEW)
Super Admin Configuration
/cipp/super-admin/jit-admin-settings(new tab in Super Admin section)Backend Validation
When creating a JIT admin, the backend must:
ExecJITAdminSettings(Get action)requestedDuration = endDate - startDaterequestedDuration > maxDuration, REJECT with error:ISO 8601 Examples
PT4H= 4 hoursP1D= 1 dayP7D= 1 weekP4W= 4 weeksP28D= 28 days (4 weeks)PT2H30M= 2 hours 30 minutes🔧 User Action Configuration
For AllTenants Templates:
For Specific Tenant Templates:
Auto-population in JIT Admin Creation:
defaultUserActionsets the user action radio button🔧 Template Filtering Logic
When TenantFilter = Specific Tenant:
When TenantFilter = AllTenants:
🔧 Duration Format
Presets: PT1H, PT4H, PT8H, P1D, P3D, P7D, P14D, P30D
Custom Examples:
PT2H30M= 2 hours 30 minutesP1DT12H= 1 day 12 hoursP1Y2M3DT4H5M6S= Complex durationValidation: Simple inline regex with helper text
🔌 Backend API Required
JIT Admin Templates:
GET
/api/ListJITAdminTemplates- List with tenant filteringPOST
/api/AddJITAdminTemplate- Create templatedefaultUserAction: "select"defaultDomainordefaultExistingUserfieldsdefaultExistingUserwhendefaultUserAction: "select"defaultForTenant: true(one per tenant type)POST
/api/EditJITAdminTemplate- Update templatePOST
/api/RemoveJITAdminTemplate- Delete templateMaximum Duration Setting (NEW):
/api/ExecJITAdminSettings- Get/Set maximum duration setting{ "Action": "Get" }{ "MaxDuration": "P28D" } // or null{ "Action": "Set", "MaxDuration": "P28D" // or null for no limit }Enhanced JIT Admin Creation:
/api/ExecJitAdmin- Create JIT admin with duration validation📚 Template Fields in API
Template object includes:
{ "tenantFilter": "string (tenant ID or 'AllTenants')", "templateName": "string", "defaultForTenant": "boolean", "defaultRoles": [...], "defaultDuration": "string (ISO 8601)", "defaultUserAction": "create" | "select", "defaultFirstName": "string (optional, for create action)", "defaultLastName": "string (optional, for create action)", "defaultUserName": "string (optional, for create action)", "defaultDomain": "string or object (optional, for create action, specific tenant only)", "defaultExistingUser": "object (optional, for select action, specific tenant only)", ... }Default Template Behavior:
defaultForTenant: trueValidation Rules:
tenantFilter === "AllTenants"anddefaultUserAction === "select": REJECTtenantFilter === "AllTenants"anddefaultDomainis provided: REJECTtenantFilter === "AllTenants"anddefaultExistingUseris provided: REJECTdefaultUserAction === "create"defaultDomainonly valid for specific tenant templates whendefaultUserAction === "create"defaultExistingUseronly valid for specific tenant templates whendefaultUserAction === "select"Example with Existing User:
{ "tenantFilter": "contoso.onmicrosoft.com", "templateName": "Standard Support Admin", "defaultUserAction": "select", "defaultExistingUser": { "label": "John Doe (john.doe@contoso.com)", "value": "user-guid-here", "addedFields": { "userPrincipalName": "john.doe@contoso.com", "displayName": "John Doe" } }, "defaultRoles": [...], ... }📚 Documentation
Complete API specifications provided:
✅ Testing
🎉 Benefits
🚀 Status
✅ Frontend complete and ready for backend API implementation
Backend team: Implement 6 API endpoints per specifications (4 template endpoints + 1 settings endpoint + enhanced ExecJitAdmin validation)
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.