Documentation base URLs use placeholder https://{your-tenant}.sso.id. Log in to show your tenant or custom domain.
Log in for Your Tenant URL
Chapter 5 — Fine-Grained Role-Based Access Control (RBAC)

Role Management: Menu CRUD Matrix & API Permissions

Stop hardcoding if (user.role === 'admin') across hundreds of UI components and backend controllers. In SSO.ID v2 ( /role-management), a single Role governs both Frontend Navigation Menus (view, add, update, delete) AND Backend Application API Endpoints (GET, POST, PUT, DELETE).

Engineering Story: Customizing Permissions Without Redeploying Code

How CloudPulse Created a "Junior Billing Auditor" Role in 45 Seconds

A customer asked CloudPulse for a custom Junior Billing Auditor role that could view the Invoices and Refunds menus in the web app, create credit notes, but never delete an invoice or call DELETE /v1/invoices/{id} on the backend API.

In a traditional codebase, that request requires a frontend PR, a backend PR, QA regression testing, and a production deployment. With SSO.ID v2, CloudPulse's product manager opened /role-management, created the Junior Billing Auditor role, checked View on the Invoices menu node (PUT /api/roles/{roleId}/applications/{appId}/menu-access), and unchecked DELETE /v1/invoices/{id} in the API Permissions tab (PUT /api/roles/{roleId}/applications/{appId}/api-access). Both the Angular UI and .NET API enforced the new rule immediately.

1. The SSO.ID v2 Dual-Layer RBAC Architecture

Layer 1: UI Menu CRUD Permissions (menu-access)

Controls what the user sees and clicks in the frontend application. Every hierarchical page defined in App Pages (/api/applications/{id}/menus) exposes four boolean permission flags per Role: canView, canAdd, canUpdate, and canDelete.

Layer 2: Backend API Route Permissions (api-access)

Controls what the user's JWT can execute on the server. Every backend API endpoint registered under /api/applications/{id}/apis can be toggled ON or OFF per Role (PUT /api/roles/{roleId}/applications/{appId}/api-access).

Flow Diagram Dual-Layer RBAC Enforcement Flow
flowchart LR ROLE["Role Definition (POST /api/roles)"] --> L1["Layer 1: Menu CRUD (View, Add, Update, Delete)"] ROLE --> L2["Layer 2: API Endpoints (GET, POST, PUT, DELETE)"] L1 --> JWT["Signed JWT Claims (menus: [...], roles: [...])"] L2 --> JWT JWT --> FE["SPA Frontend: Dynamic Menu Tree"] JWT --> BE["API Gateway: Endpoint Authorization"]
Roles define frontend Menu CRUD bitmasks and backend API endpoints, delivering both UI navigation and API permission claims in signed JWTs.
https://cloudpulse.us.beta.sso.id/role-management Click to zoom
Role Management console at /role-management for configuring application RBAC roles and CRUD matrices.
Role Management console at /role-management for configuring application RBAC roles and CRUD matrices.

3. Configuring Backend API Access & Assigning Users

  • API Permissions Tab (GET / PUT /api/roles/{roleId}/applications/{appId}/api-access): View all registered backend endpoints for the selected Application (with HTTP method badges GET, POST, PUT, DELETE) and toggle which APIs this Role is authorized to call.
  • Assigned Users Tab (GET / POST / DELETE /api/roles/{roleId}/applications/{appId}/users): Search directory users and assign or remove them from this Role within the selected Application context.

4. Role Management REST API Reference

Method Endpoint Description
GET / POST https://{your-tenant}.sso.id/api/roles Lists all roles in the tenant or creates a new role (PUT / DELETE /api/roles/{id}).
GET https://{your-tenant}.sso.id/api/roles/applications/{applicationId} Lists all roles associated with a specific Application.
GET / PUT https://{your-tenant}.sso.id/api/roles/{roleId}/applications/{appId}/menu-access Gets or updates the hierarchical App Menu CRUD permission matrix (view, add, update, delete) for a Role.
GET / PUT https://{your-tenant}.sso.id/api/roles/{roleId}/applications/{appId}/api-access Gets or updates the allowed backend Application API endpoints for a Role.
GET / POST / DELETE https://{your-tenant}.sso.id/api/roles/{roleId}/applications/{appId}/users Lists, assigns, or removes (DELETE .../users/{userId}) users for a Role in an Application.

Role Management, Menu CRUD Matrix & API RBAC Specifications

Below is the complete parameter-level specification for every endpoint in this module. Tenant context is automatically resolved from the signed Bearer JWT token claims or the tenant domain URL (no custom tenant header is required).

GET https://{your-tenant}.sso.id/api/roles
Bearer JWT

Lists all Application Roles configured in the tenant workspace. To filter roles for a specific Application only, call GET /api/roles/applications/{applicationId}.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
Response Fields & Schema
Field Type Description
roleId string (UUID) Unique Role UUID.
applicationId string (UUID) Application UUID to which this role is scoped.
applicationName string Display name of the parent application.
roleName string Role identifier emitted in the JWT roles claim (e.g., BillingAdmin, SupportAgent).
roleDescription string Human-readable description of the role's responsibilities.
isDefault boolean When true, newly registered or JIT-provisioned users in this application automatically receive this role.
createdOn string (ISO 8601) Role creation UTC timestamp.
Sample Request
curl -X GET "https://{your-tenant}.sso.id/api/roles/applications/app_7712b" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..."
Expected Response 200 OK
[
  {
    "roleId": "rol_3310a-11b2-4c3d-8e9f-001122334455",
    "applicationId": "app_7712b",
    "applicationName": "CloudPulse CRM",
    "roleName": "Support Specialist",
    "roleDescription": "Tier-1 customer support & ticket management access",
    "isDefault": true,
    "createdOn": "2026-10-01T10:00:00Z"
  }
]
POST https://{your-tenant}.sso.id/api/roles
Bearer JWT

Creates a new Application Role. To update an existing role, call PUT /api/roles/{roleId}; to delete a role, call DELETE /api/roles/{roleId}?appId={appId}.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
applicationId Body string (UUID) Required Target Application UUID.
roleName Body string Required Role name (1-100 characters, e.g., FinanceManager).
roleDescription Body string Optional Detailed description of the role.
isDefault Body boolean Optional Automatically assign this role to new users of the application (default: false).
canViewSetup Body boolean Optional Optional administrative capability flag.
canManageUsers Body boolean Optional Optional user management capability flag.
canManageRoles Body boolean Optional Optional role management capability flag.
Response Fields & Schema
Field Type Description
roleId string (UUID) Generated Role UUID.
applicationId string (UUID) Application UUID.
roleName string Created role name.
isDefault boolean Default assignment flag.
Sample Request
curl -X POST "https://{your-tenant}.sso.id/api/roles" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '{
    "applicationId": "app_7712b",
    "roleName": "Finance Manager",
    "roleDescription": "Full CRUD access to invoices, refunds, and financial reports",
    "isDefault": false
  }'
Expected Response 201 Created
{
  "roleId": "rol_99441122-3344-4556-8778-99aabbccddee",
  "applicationId": "app_7712b",
  "roleName": "Finance Manager",
  "roleDescription": "Full CRUD access to invoices, refunds, and financial reports",
  "isDefault": false,
  "createdOn": "2026-11-19T12:48:00Z"
}
PUT https://{your-tenant}.sso.id/api/roles/{roleId}/applications/{appId}/menu-access
Bearer JWT

Updates the hierarchical App Page CRUD permission matrix (viewAccess, addAccess, updateAccess, deleteAccess) for a Role within an Application. To fetch the current matrix, call GET /api/roles/{roleId}/applications/{appId}/menu-access.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
roleId Path string (UUID) Required Target Role UUID.
appId Path string (UUID) Required Target Application UUID.
Body Body array Required Array of menu permission objects.
[].menuId Body string (UUID) Required App Page / Menu node UUID.
[].parentId Body string (UUID) Optional Parent Menu node UUID (or null for root nodes).
[].viewAccess Body boolean Required Permits viewing and navigating to the page in the sidebar.
[].addAccess Body boolean Required Permits creating new records on the page.
[].updateAccess Body boolean Required Permits editing existing records on the page.
[].deleteAccess Body boolean Required Permits deleting records on the page.
[].isSelected Body boolean Optional Indicates whether the menu node is enabled for the role.
Response Fields & Schema
Field Type Description
status boolean True when the Role Menu CRUD matrix is saved.
updatedCount integer Number of menu permission nodes updated.
Sample Request
curl -X PUT "https://{your-tenant}.sso.id/api/roles/rol_99441122/applications/app_7712b/menu-access" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '[
    {
      "roleId": "rol_99441122",
      "applicationId": "app_7712b",
      "menuId": "mnu_invoices_01",
      "viewAccess": true,
      "addAccess": true,
      "updateAccess": true,
      "deleteAccess": false,
      "isSelected": true
    }
  ]'
Expected Response 200 OK
{
  "status": true,
  "updatedCount": 1,
  "message": "Role menu access permissions updated successfully."
}
PUT https://{your-tenant}.sso.id/api/roles/{roleId}/applications/{appId}/api-access
Bearer JWT

Updates the backend API endpoint authorization list for a Role. Use GET /api/roles/{roleId}/applications/{appId}/api-access to retrieve the current allowed API endpoints for the role.

Request Parameters
Parameter Type Required Description & Constraints
Authorization Header string Required Bearer JWT access token (Bearer eyJhbG...). Tenant context is resolved automatically from the token claims or request domain URL.
roleId Path string (UUID) Required Target Role UUID.
appId Path string (UUID) Required Target Application UUID.
Body Body array Required Array of API permission mappings.
[].apiId Body string (UUID) Required Registered Application API endpoint UUID.
[].hasAccess Body boolean Required Set to true to authorize the role to call this backend API route.
Response Fields & Schema
Field Type Description
status boolean True when API route permissions are updated.
updatedCount integer Count of API access rules saved.
Sample Request
curl -X PUT "https://{your-tenant}.sso.id/api/roles/rol_99441122/applications/app_7712b/api-access" \
  -H "Authorization: Bearer eyJhbGciOiJSUzI1NiIs..." \
  -H "Content-Type: application/json" \
  -d '[
    {
      "roleId": "rol_99441122",
      "applicationId": "app_7712b",
      "apiId": "api_create_invoice_01",
      "hasAccess": true
    }
  ]'
Expected Response 200 OK
{
  "status": true,
  "updatedCount": 1,
  "message": "Role API access rules updated successfully."
}
AI Agent Prompt Implement Dynamic Frontend Menu Guards & Backend API RBAC Enforcement
You are a full-stack security architect. Implement **Dynamic Menu CRUD Guards (Frontend) and API Route Authorization (Backend)** powered by **SSO.ID v2 Role Management** (`https://{your-tenant}.sso.id/api/roles`).

### 1. Frontend Dynamic Sidebar & Action Button Directive
- Fetch the user's assigned roles and menu permissions from `/api/roles/{roleId}/applications/{appId}/menu-access`.
- Build a navigation sidebar that renders only menu nodes where `canView === true` (preserving parent-child hierarchy).
- Create a reusable UI permission directive/component `` that conditionally hides or disables Create, Edit, and Delete buttons.

### 2. Backend API Route Authorization Middleware
- Validate the incoming Bearer JWT against `https://{your-tenant}.sso.id/auth/.well-known/jwks.json?appId={appId}`.
- Extract the user's `roles` claim and verify against cached `/api/roles/{roleId}/applications/{appId}/api-access` rules that the user's role is permitted to invoke the current HTTP method and route path.