Setup and Management Guide
Last Updated: February 18, 2026
This guide covers configuration, user management, and creating custom roles.
Table of Contents
- Environment Configuration
- Enabling and Disabling Permissions
- Managing Users and Groups
- Assigning Users to Groups
- Creating Custom Composite Roles
- Troubleshooting Setup Issues
Environment Configuration
The permissions system uses environment variables to control its behavior.
Required Environment Variables
Add these to your .env file:
# Keycloak Connection
KEYCLOAK_URL=http://localhost:8080
KEYCLOAK_REALM=getapp
KEYCLOAK_CLIENT_ID=api
# Admin Credentials (for automatic role setup)
KEYCLOAK_ADMIN_USER=admin
KEYCLOAK_ADMIN_PASSWORD=your-admin-password
###Optional Environment Variables
# Auto-sync roles and groups on startup (default: true)
KEYCLOAK_AUTO_SYNC_ROLES=true
# Enable permission checking globally (default: false)
ENABLE_PERMISSIONS=false
Environment Variable Reference
| Variable | Required | Default | Description |
|---|---|---|---|
KEYCLOAK_URL | Yes | - | The web address of your Keycloak server |
KEYCLOAK_REALM | Yes | - | Your Keycloak realm name (usually getapp) |
KEYCLOAK_CLIENT_ID | Yes | - | Your application client ID (usually api) |
KEYCLOAK_ADMIN_USER | Yes | - | Keycloak admin username for auto-sync |
KEYCLOAK_ADMIN_PASSWORD | Yes | - | Keycloak admin password for auto-sync |
KEYCLOAK_AUTO_SYNC_ROLES | No | true | Automatically sync roles and groups on startup |
ENABLE_PERMISSIONS | No | false | Enable permission checking for all users |
Where to Find These Values
- KEYCLOAK_URL: The web address where you access Keycloak (e.g.,
http://localhost:8080orhttps://auth.yourcompany.com) - KEYCLOAK_REALM: Found in Keycloak admin console under "Realm Settings"
- KEYCLOAK_CLIENT_ID: Found in Keycloak under Clients (the client representing your API)
- KEYCLOAK_ADMIN_USER: The username you use to log into the Keycloak admin console
- KEYCLOAK_ADMIN_PASSWORD: The password for the admin user
Enabling and Disabling Permissions
By default, permission checking is disabled. This means users can access any endpoint without role validation.
How to Enable Permissions
You have two options:
Option 1: Enable for Everyone (Global)
Set the environment variable:
ENABLE_PERMISSIONS=true
Effect: All users must have the required roles to access protected endpoints.
When to use:
- In production environments
- When you're ready to enforce permissions for everyone
- For new installations where you want security from day one
Option 2: Enable for Specific Users (Gradual Rollout)
Keep ENABLE_PERMISSIONS=false (or omit it), and assign the permissions-enabled role to specific users in Keycloak.
Effect: Only users with the permissions-enabled role have permission checking enforced. Others can access everything.
When to use:
- Testing the permissions system with a few users
- Gradual rollout to avoid disrupting existing users
- Training new administrators before full deployment
Configuration Scenarios
Scenario 1: Development Environment
Goal: Allow developers to access everything without restrictions
ENABLE_PERMISSIONS=false
KEYCLOAK_AUTO_SYNC_ROLES=true
Result: Roles are created automatically, but no permission checking is enforced.
Scenario 2: Testing Permissions
Goal: Test permissions with a few users before rolling out
ENABLE_PERMISSIONS=false
KEYCLOAK_AUTO_SYNC_ROLES=true
Then assign the permissions-enabled role to test users in Keycloak.
Result: Only test users have permission checking active.
Scenario 3: Production Environment
Goal: Full security with permission checking for everyone
ENABLE_PERMISSIONS=true
KEYCLOAK_AUTO_SYNC_ROLES=true
Result: All users must have appropriate roles to access endpoints.
Scenario 4: Manual Role Management
Goal: Full control over role definitions in Keycloak
ENABLE_PERMISSIONS=true
KEYCLOAK_AUTO_SYNC_ROLES=false
Result: You manage all roles manually. System doesn't modify Keycloak.
How to Disable Permissions
Option 1: Disable Globally
Set the environment variable:
ENABLE_PERMISSIONS=false
or remove the variable entirely from your .env file.
Effect: No permission checking for anyone—all users can access all endpoints.
Option 2: Remove Individual User Enforcement
Remove the permissions-enabled role from all users in Keycloak while keeping ENABLE_PERMISSIONS=false.
Effect: All users can access everything (no permission checking).
Disabling Automatic Role Synchronization
If you want to manage roles manually and disable automatic setup:
KEYCLOAK_AUTO_SYNC_ROLES=false
Warning: Only disable this if you plan to manage roles manually in Keycloak. You'll need to:
- Manually create all roles
- Manually configure composite roles
- Manually create and link groups
- Manually update roles when the system adds new features
Recommendation: Keep auto-sync enabled unless you have a specific reason to manage roles manually.
Managing Users and Groups
What are Groups?
Groups are collections of users who share the same permissions. Think of them like departments or teams in your organization.
Pre-configured Groups
The system automatically creates these groups:
Contributors Group
- Automatic Role:
contributorcomposite role - Members Get: All contributor permissions automatically
- Who should be here: Developers, product managers, QA engineers, designers
System Administrators Group
- Automatic Role:
system-administratorcomposite role - Members Get: Full system management permissions
- Who should be here: DevOps engineers, system administrators, IT staff
Benefits of Using Groups
✅ Easy User Management: Add a user to a group instead of assigning individual roles
✅ Consistent Permissions: All group members have the same access
✅ Quick Updates: Change group permissions once, affects all members
✅ Clear Organization: See which team each user belongs to
✅ Scalability: Manage hundreds of users efficiently
Assigning Users to Groups
In Keycloak Admin Console
Step 1: Open Keycloak Admin Console
- Navigate to
http://your-keycloak-url/admin - Login with admin credentials
- Select the correct realm (usually
getapp)
Step 2: Find the User
- Click "Users" in the left sidebar
- Use the search box to find the user
- Click on the user's username to open their profile
Step 3: Add User to Group
- Click the "Groups" tab
- Click the "Join Group" button
- Select a group from the list:
- Contributors - For project team members
- System Administrators - For IT staff
- Click "Join"
Step 4: Verify
- The group now appears in the user's "Group Membership" list
- The user automatically gets all roles from that group
- The user's next login will include the new roles
Quick Example
Scenario: You hired a new developer, Sarah
Steps:
- Create Sarah's user account in Keycloak
- Go to Sarah's user profile
- Click "Groups" tab → "Join Group"
- Select "Contributors" → Click "Join"
- Done! Sarah can now create projects, upload artifacts, and manage releases
Time to complete: 2 minutes
Removing Users from Groups
- Go to Users → Find the user
- Click on the user's username
- Go to the "Groups" tab
- Find the group in the "Group Membership" list
- Click the "Leave" button next to the group
- Confirm the removal
The user will lose all roles from that group on their next login.
Managing Multiple Groups
Can a User Be in Multiple Groups?
Yes! A user can be in multiple groups and will have the combined permissions from all their groups.
Example:
- Sarah is in "Contributors" group → Gets contributor permissions
- Sarah is also in a custom "Release Managers" group → Gets additional release management permissions
- Sarah has all permissions from both groups
Overlapping Permissions
If two groups have the same role, the user just gets that role once (no duplication or conflicts).
Creating Custom Composite Roles
Composite roles make it easier to manage groups by bundling individual roles together.
When to Create Custom Roles
- You need a different set of permissions than the pre-configured groups
- You want to organize users by department or team
- You need role-based access for specific workflows
Option 1: In Keycloak UI (Recommended)
Step 1: Navigate to Client Roles
- Go to Clients in the left sidebar
- Click on the api client
- Click the "Roles" tab
Step 2: Create New Role
- Click "Create Role"
- Enter role name (e.g.,
release-manager) - Add a description (e.g., "Composite role for release managers")
- Click "Save"
Step 3: Make it Composite
- On the role's page, toggle "Composite Role" to ON
- In the "Associated Roles" section, select api from the dropdown
Step 4: Add Child Roles
- Select the individual roles you want to include
- Click "Add selected"
- The composite role now includes all selected roles
Step 5: Assign to Users or Groups
You can now assign this composite role to users or groups like any other role
Option 2: Define in Code (For Developers)
For automatic setup, developers can add composite roles to the configuration file.
File: api/libs/common/src/oidc-roles/constants/role-definitions.constant.ts
export const COMPOSITE_ROLE_DEFINITIONS: CompositeRoleDefinition[] = [
// Existing roles...
// Add your new composite role:
{
name: 'release-manager',
description: 'Composite role for release managers',
childRoles: [
ApiRole.VIEW_PROJECT,
ApiRole.LIST_PROJECTS,
ApiRole.CREATE_RELEASE,
ApiRole.VIEW_RELEASE,
ApiRole.UPDATE_RELEASE,
ApiRole.PUBLISH_RELEASE,
ApiRole.LIST_RELEASES,
ApiRole.VIEW_ARTIFACT,
ApiRole.LIST_ARTIFACTS,
],
},
];
After adding this code, restart the API service. The new composite role will be created automatically!
Example Custom Composite Roles
Release Manager
Purpose: Users who manage releases but don't create projects
{
name: 'release-manager',
description: 'Manage releases and artifacts',
childRoles: [
ApiRole.VIEW_PROJECT,
ApiRole.LIST_PROJECTS,
ApiRole.CREATE_RELEASE,
ApiRole.VIEW_RELEASE,
ApiRole.UPDATE_RELEASE,
ApiRole.PUBLISH_RELEASE,
ApiRole.LIST_RELEASES,
ApiRole.VIEW_ARTIFACT,
ApiRole.DOWNLOAD_ARTIFACT,
ApiRole.LIST_ARTIFACTS,
ApiRole.VIEW_ANALYTICS,
],
}
Viewer
Purpose: Stakeholders who need read-only access
{
name: 'viewer',
description: 'Read-only access to all resources',
childRoles: [
ApiRole.VIEW_PROJECT,
ApiRole.LIST_PROJECTS,
ApiRole.VIEW_RELEASE,
ApiRole.LIST_RELEASES,
ApiRole.VIEW_ARTIFACT,
ApiRole.LIST_ARTIFACTS,
ApiRole.VIEW_OFFERING,
ApiRole.VIEW_DISCOVERY,
ApiRole.VIEW_USER,
ApiRole.VIEW_ANALYTICS,
ApiRole.VIEW_LOGS,
ApiRole.VIEW_METRICS,
ApiRole.VIEW_CONFIG,
],
}
DevOps Engineer
Purpose: Engineers who deploy but don't develop
{
name: 'devops-engineer',
description: 'Deploy and monitor applications',
childRoles: [
ApiRole.VIEW_PROJECT,
ApiRole.VIEW_RELEASE,
ApiRole.VIEW_ARTIFACT,
ApiRole.DOWNLOAD_ARTIFACT,
ApiRole.DEPLOY_DEV,
ApiRole.DEPLOY_STAGING,
ApiRole.DEPLOY_PRODUCTION,
ApiRole.MANAGE_DISCOVERY,
ApiRole.VIEW_METRICS,
ApiRole.VIEW_LOGS,
ApiRole.MANAGE_DEVICES,
],
}
Creating Custom Groups
Once you have a custom composite role, create a group for it:
- Go to Groups in the left sidebar
- Click "Create group"
- Enter the group name (e.g., "Release Managers")
- Click "Create"
- Click on the newly created group
- Go to the "Role Mappings" tab
- Select "api" from the "Client Roles" dropdown
- Add your custom composite role
- Click "Add selected"
Now you can add users to this group, and they'll automatically get all the roles from your custom composite role.
Troubleshooting Setup Issues
Roles Not Appearing in Keycloak
Problem: After starting the API service, roles don't appear in Keycloak
Solutions:
- Check the API service logs for errors
- Verify
KEYCLOAK_ADMIN_USERandKEYCLOAK_ADMIN_PASSWORDare correct - Ensure
KEYCLOAK_AUTO_SYNC_ROLESis not set tofalse - Verify the Keycloak URL and realm are correct
- Check that the admin user has permission to create roles and groups
Permission Checking Not Working
Problem: Users can access endpoints they shouldn't
Solutions:
- Verify
ENABLE_PERMISSIONS=trueis set - If using per-user enforcement, check that users have the
permissions-enabledrole - Clear browser cache and get a fresh authentication token
- Check that the user's roles are correctly set in Keycloak
- Review API logs for permission check messages
Synchronization Fails on Startup
Problem: API logs show errors during role synchronization
Solutions:
- Verify Keycloak is running and accessible
- Check network connectivity to Keycloak
- Verify admin credentials are correct
- Check Keycloak logs for errors
- Ensure the
apiclient exists in Keycloak
User Has Role But Still Can't Access
Problem: User has the correct role in Keycloak but still gets permission errors
Solutions:
- Have user log out completely and log back in
- Clear browser cache
- Use jwt.io to decode the user's access token and verify the role appears in the token
- Verify role is a client role (under
apiclient), not a realm role - Check if permission checking is enabled (
ENABLE_PERMISSIONS=trueor user haspermissions-enabledrole)
Changes Not Taking Effect
Problem: Role or group changes in Keycloak don't seem to work
Root Cause: User's authentication token is cached and hasn't been refreshed
Solution:
- Have the user log out of GetApp
- Have the user log back in
- The new token will include updated roles
Alternative: Wait for token expiration (usually 5-60 minutes depending on configuration)
Best Practices
User Management
✅ Use groups instead of assigning roles directly to users
✅ Use composite roles for common permission sets
✅ Document custom roles - Keep a record of what each custom role is for
✅ Review permissions regularly - Audit group memberships quarterly
✅ Keep at least 2 system administrators - Prevent lockouts
❌ Don't assign hundreds of individual roles to users
❌ Don't give everyone admin access "just in case"
Security
✅ Start with minimal permissions - Add more as needed
✅ Test changes with a single user before rolling out
✅ Use service accounts with limited permissions for automated systems
✅ Enable permissions in production - Set ENABLE_PERMISSIONS=true
❌ Don't disable permissions in production unless necessary
❌ Don't share admin credentials across multiple people
Operations
✅ Monitor the auto-sync logs on startup
✅ Keep Keycloak admin credentials secure
✅ Document your custom composite roles
✅ Have a process for emergency access
❌ Don't manually modify auto-synced roles in Keycloak (they'll be overwritten)
❌ Don't disable auto-sync unless you're managing roles manually
Next Steps
- Return to the Overview for basic concepts
- Check the Roles Reference and Scenarios for complete role listings and real-world examples
- Review the Keycloak admin console to verify your setup
Need help? Check the troubleshooting section or review the Roles Reference for more examples.