This document provides a comprehensive reference for all authorization and RBAC (Role-Based Access Control) APIs available in the Conductor Python SDK.
π Complete Working Example: See authorization_journey.py for a comprehensive example.
- Applications
- Application Roles
- Application Tags
- Access Keys
- Users
- Groups
- Group Users
- Permissions
- Roles
- Token & Authentication
- API Gateway Authentication
Manage applications in your Conductor instance.
| Method | Endpoint | Description | Example |
|---|---|---|---|
create_application() |
POST /api/applications |
Create a new application | Example |
get_application() |
GET /api/applications/{id} |
Get application by ID | Example |
list_applications() |
GET /api/applications |
List all applications | Example |
update_application() |
PUT /api/applications/{id} |
Update an existing application | Example |
delete_application() |
DELETE /api/applications/{id} |
Delete an application | Example |
get_app_by_access_key_id() |
GET /api/applications/key/{accessKeyId} |
Get application ID by access key | Example |
from conductor.client.configuration.configuration import Configuration
from conductor.client.orkes.orkes_authorization_client import OrkesAuthorizationClient
from conductor.client.http.models.create_or_update_application_request import CreateOrUpdateApplicationRequest
configuration = Configuration()
auth_client = OrkesAuthorizationClient(configuration)
# Create application
request = CreateOrUpdateApplicationRequest(name="my-application")
app = auth_client.create_application(request)
print(f"Created application with ID: {app.id}")# Get application by ID
app = auth_client.get_application("app-id-123")
print(f"Application name: {app.name}")# List all applications
apps = auth_client.list_applications()
for app in apps:
print(f"App ID: {app.id}, Name: {app.name}")# Update application
request = CreateOrUpdateApplicationRequest(name="my-updated-application")
updated_app = auth_client.update_application(request, "app-id-123")# Delete application
auth_client.delete_application("app-id-123")# Get application ID by access key
app_id = auth_client.get_app_by_access_key_id("access-key-123")
print(f"Application ID: {app_id}")Manage roles for application users.
| Method | Endpoint | Description | Example |
|---|---|---|---|
add_role_to_application_user() |
POST /api/applications/{applicationId}/roles/{role} |
Add a role to application user | Example |
remove_role_from_application_user() |
DELETE /api/applications/{applicationId}/roles/{role} |
Remove a role from application user | Example |
Available Roles:
USER- Basic user accessADMIN- Administrative accessMETADATA_MANAGER- Manage workflow/task definitionsWORKFLOW_MANAGER- Manage workflow executionsWORKER- Worker task execution access
# Add role to application user
auth_client.add_role_to_application_user("app-id-123", "ADMIN")# Remove role from application user
auth_client.remove_role_from_application_user("app-id-123", "ADMIN")Manage tags for applications.
| Method | Endpoint | Description | Example |
|---|---|---|---|
set_application_tags() |
PUT /api/applications/{id}/tags |
Set/add tags to application | Example |
get_application_tags() |
GET /api/applications/{id}/tags |
Get all tags for application | Example |
delete_application_tags() |
DELETE /api/applications/{id}/tags |
Delete tags from application | Example |
from conductor.client.orkes.models.metadata_tag import MetadataTag
# Set application tags
tags = [
MetadataTag("environment", "production"),
MetadataTag("team", "platform")
]
auth_client.set_application_tags(tags, "app-id-123")# Get application tags
tags = auth_client.get_application_tags("app-id-123")
for tag in tags:
print(f"Tag: {tag.key} = {tag.value}")# Delete specific tags
tags = [
MetadataTag("environment", "production")
]
auth_client.delete_application_tags(tags, "app-id-123")Manage access keys for applications.
| Method | Endpoint | Description | Example |
|---|---|---|---|
create_access_key() |
POST /api/applications/{id}/accessKeys |
Create a new access key | Example |
get_access_keys() |
GET /api/applications/{id}/accessKeys |
Get all access keys for application | Example |
toggle_access_key_status() |
POST /api/applications/{applicationId}/accessKeys/{keyId}/status |
Toggle access key active/inactive | Example |
delete_access_key() |
DELETE /api/applications/{applicationId}/accessKeys/{keyId} |
Delete an access key | Example |
# Create access key
access_key = auth_client.create_access_key("app-id-123")
# IMPORTANT: Save the secret immediately - it's only shown once!
print(f"Key ID: {access_key.id}")
print(f"Secret: {access_key.secret}") # Only available at creation time# Get all access keys for an application
keys = auth_client.get_access_keys("app-id-123")
for key in keys:
print(f"Key ID: {key.id}, Status: {key.status}")# Toggle access key between ACTIVE and INACTIVE
key = auth_client.toggle_access_key_status("app-id-123", "key-id-456")
print(f"New status: {key.status}")# Delete access key
auth_client.delete_access_key("app-id-123", "key-id-456")Manage users in your Conductor instance.
| Method | Endpoint | Description | Example |
|---|---|---|---|
upsert_user() |
PUT /api/users/{id} |
Create or update a user | Example |
get_user() |
GET /api/users/{id} |
Get user by ID | Example |
list_users() |
GET /api/users |
List all users | Example |
delete_user() |
DELETE /api/users/{id} |
Delete a user | Example |
get_granted_permissions_for_user() |
GET /api/users/{userId}/permissions |
Get all permissions granted to user | Example |
check_permissions() |
GET /api/users/{userId}/checkPermissions |
Check if user has specific permissions | Example |
from conductor.client.http.models.upsert_user_request import UpsertUserRequest
# Create or update user
user_id = "user@example.com"
request = UpsertUserRequest(
name="John Doe",
roles=["USER", "METADATA_MANAGER"]
)
user = auth_client.upsert_user(request, user_id)
print(f"User created: {user.id}")# Get user by ID
user = auth_client.get_user("user@example.com")
print(f"User name: {user.name}")
print(f"Roles: {user.roles}")# List all users
users = auth_client.list_users()
for user in users:
print(f"User: {user.id}, Name: {user.name}")
# List users including applications
users_with_apps = auth_client.list_users(apps=True)# Delete user
auth_client.delete_user("user@example.com")# Get all permissions granted to user
permissions = auth_client.get_granted_permissions_for_user("user@example.com")
for perm in permissions:
print(f"Target: {perm.target.type}:{perm.target.id}")
print(f"Access: {perm.access}")# Check if user has specific permissions on a target
result = auth_client.check_permissions(
user_id="user@example.com",
target_type="WORKFLOW_DEF",
target_id="my-workflow"
)
print(f"Has access: {result}")Manage user groups in your Conductor instance.
| Method | Endpoint | Description | Example |
|---|---|---|---|
upsert_group() |
PUT /api/groups/{id} |
Create or update a group | Example |
get_group() |
GET /api/groups/{id} |
Get group by ID | Example |
list_groups() |
GET /api/groups |
List all groups | Example |
delete_group() |
DELETE /api/groups/{id} |
Delete a group | Example |
get_granted_permissions_for_group() |
GET /api/groups/{groupId}/permissions |
Get all permissions granted to group | Example |
from conductor.client.http.models.upsert_group_request import UpsertGroupRequest
# Create or update group
group_id = "engineering-team"
request = UpsertGroupRequest(
description="Engineering Team",
roles=["USER", "WORKFLOW_MANAGER"]
)
group = auth_client.upsert_group(request, group_id)
print(f"Group created: {group.id}")# Get group by ID
group = auth_client.get_group("engineering-team")
print(f"Group description: {group.description}")
print(f"Roles: {group.roles}")# List all groups
groups = auth_client.list_groups()
for group in groups:
print(f"Group: {group.id}, Description: {group.description}")# Delete group
auth_client.delete_group("engineering-team")# Get all permissions granted to group
permissions = auth_client.get_granted_permissions_for_group("engineering-team")
for perm in permissions:
print(f"Target: {perm.target.type}:{perm.target.id}")
print(f"Access: {perm.access}")Manage users within groups.
| Method | Endpoint | Description | Example |
|---|---|---|---|
add_user_to_group() |
POST /api/groups/{groupId}/users/{userId} |
Add a single user to group | Example |
add_users_to_group() |
POST /api/groups/{groupId}/users |
Add multiple users to group | Example |
get_users_in_group() |
GET /api/groups/{id}/users |
Get all users in group | Example |
remove_user_from_group() |
DELETE /api/groups/{groupId}/users/{userId} |
Remove a single user from group | Example |
remove_users_from_group() |
DELETE /api/groups/{groupId}/users |
Remove multiple users from group | Example |
# Add single user to group
auth_client.add_user_to_group("engineering-team", "user@example.com")# Add multiple users to group (bulk operation)
user_ids = [
"user1@example.com",
"user2@example.com",
"user3@example.com"
]
auth_client.add_users_to_group("engineering-team", user_ids)# Get all users in a group
users = auth_client.get_users_in_group("engineering-team")
for user in users:
print(f"User: {user.id}, Name: {user.name}")# Remove single user from group
auth_client.remove_user_from_group("engineering-team", "user@example.com")# Remove multiple users from group (bulk operation)
user_ids = [
"user1@example.com",
"user2@example.com"
]
auth_client.remove_users_from_group("engineering-team", user_ids)Manage permissions and access control.
| Method | Endpoint | Description | Example |
|---|---|---|---|
grant_permissions() |
POST /api/auth/authorization |
Grant permissions to subject on target | Example |
get_permissions() |
GET /api/auth/authorization/{type}/{id} |
Get all permissions for a target | Example |
remove_permissions() |
DELETE /api/auth/authorization |
Remove permissions from subject on target | Example |
Target Types:
WORKFLOW_DEF- Workflow definitionTASK_DEF- Task definitionAPPLICATION- ApplicationUSER- UserDOMAIN- Domain
Subject Types:
USER- Individual userGROUP- User groupROLE- Role
Access Types:
READ- Read accessCREATE- Create accessUPDATE- Update accessEXECUTE- Execute accessDELETE- Delete access
from conductor.client.http.models.target_ref import TargetRef, TargetType
from conductor.client.http.models.subject_ref import SubjectRef, SubjectType
from conductor.client.orkes.models.access_type import AccessType
# Grant permissions to a group on a workflow
target = TargetRef(TargetType.WORKFLOW_DEF, "order-processing-workflow")
subject = SubjectRef(SubjectType.GROUP, "engineering-team")
access = [AccessType.READ, AccessType.EXECUTE]
auth_client.grant_permissions(subject, target, access)
# Grant permissions to a user on a task
target = TargetRef(TargetType.TASK_DEF, "send-email-task")
subject = SubjectRef(SubjectType.USER, "user@example.com")
access = [AccessType.READ, AccessType.UPDATE]
auth_client.grant_permissions(subject, target, access)from conductor.client.http.models.target_ref import TargetRef, TargetType
# Get all permissions for a workflow
target = TargetRef(TargetType.WORKFLOW_DEF, "order-processing-workflow")
permissions = auth_client.get_permissions(target)
# permissions is a Dict[str, List[SubjectRef]]
# Key is AccessType, value is list of subjects with that access
for access_type, subjects in permissions.items():
print(f"Access Type: {access_type}")
for subject in subjects:
print(f" Subject: {subject.type}:{subject.id}")from conductor.client.http.models.target_ref import TargetRef, TargetType
from conductor.client.http.models.subject_ref import SubjectRef, SubjectType
from conductor.client.orkes.models.access_type import AccessType
# Remove permissions from a group
target = TargetRef(TargetType.WORKFLOW_DEF, "order-processing-workflow")
subject = SubjectRef(SubjectType.GROUP, "engineering-team")
access = [AccessType.EXECUTE]
auth_client.remove_permissions(subject, target, access)Manage custom roles and role-based access control.
| Method | Endpoint | Description | Example |
|---|---|---|---|
list_all_roles() |
GET /api/roles |
List all roles (system + custom) | Example |
list_system_roles() |
GET /api/roles/system |
List system-defined roles | Example |
list_custom_roles() |
GET /api/roles/custom |
List custom roles only | Example |
list_available_permissions() |
GET /api/roles/permissions |
List all available permissions | Example |
create_role() |
POST /api/roles |
Create a new custom role | Example |
get_role() |
GET /api/roles/{name} |
Get role by name | Example |
update_role() |
PUT /api/roles/{name} |
Update an existing custom role | Example |
delete_role() |
DELETE /api/roles/{name} |
Delete a custom role | Example |
# List all roles (system + custom)
roles = auth_client.list_all_roles()
for role in roles:
print(f"Role: {role['name']}")
print(f" Description: {role.get('description', 'N/A')}")
print(f" Type: {role.get('type', 'custom')}")# List system-defined roles
system_roles = auth_client.list_system_roles()
for role_name, role_data in system_roles.items():
print(f"System Role: {role_name}")
print(f" Permissions: {role_data.get('permissions', [])}")# List custom roles only
custom_roles = auth_client.list_custom_roles()
for role in custom_roles:
print(f"Custom Role: {role['name']}")# List all available permissions that can be assigned to roles
permissions = auth_client.list_available_permissions()
for resource_type, perms in permissions.items():
print(f"Resource: {resource_type}")
print(f" Permissions: {perms}")# Create a custom role
role_request = {
"name": "workflow-operator",
"description": "Can execute and monitor workflows",
"permissions": [
{
"resource": "WORKFLOW_DEF",
"actions": ["READ", "EXECUTE"]
},
{
"resource": "WORKFLOW",
"actions": ["READ", "EXECUTE"]
}
]
}
role = auth_client.create_role(role_request)
print(f"Created role: {role['name']}")# Get role by name
role = auth_client.get_role("workflow-operator")
print(f"Role: {role['name']}")
print(f"Permissions: {role['permissions']}")# Update an existing custom role
role_update = {
"description": "Updated description",
"permissions": [
{
"resource": "WORKFLOW_DEF",
"actions": ["READ", "EXECUTE", "UPDATE"]
}
]
}
updated_role = auth_client.update_role("workflow-operator", role_update)# Delete a custom role
auth_client.delete_role("workflow-operator")Manage authentication tokens and retrieve user information.
| Method | Endpoint | Description | Example |
|---|---|---|---|
get_user_info_from_token() |
GET /api/token/userInfo |
Get user info from current auth token | Example |
generate_token() |
POST /api/token |
Generate JWT with access key credentials | Example |
# Get user information from the current authentication token
user_info = auth_client.get_user_info_from_token()
print(f"User ID: {user_info.get('id')}")
print(f"User Name: {user_info.get('name')}")
print(f"Roles: {user_info.get('roles')}")
print(f"Application: {user_info.get('application')}")# Generate JWT token using access key credentials
token_response = auth_client.generate_token(
key_id="your-access-key-id",
key_secret="your-access-key-secret"
)
jwt_token = token_response.get('token')
expires_in = token_response.get('expiresIn')
print(f"JWT Token: {jwt_token}")
print(f"Expires in: {expires_in} seconds")
# Use this token for API authentication
configuration = Configuration()
configuration.set_authentication_settings(jwt_token)Manage authentication configurations for the API Gateway.
| Method | Endpoint | Description | Example |
|---|---|---|---|
create_gateway_auth_config() |
POST /api/gateway/config/auth |
Create gateway auth configuration | Example |
get_gateway_auth_config() |
GET /api/gateway/config/auth/{id} |
Get gateway auth configuration by ID | Example |
list_gateway_auth_configs() |
GET /api/gateway/config/auth |
List all gateway auth configurations | Example |
update_gateway_auth_config() |
PUT /api/gateway/config/auth/{id} |
Update gateway auth configuration | Example |
delete_gateway_auth_config() |
DELETE /api/gateway/config/auth/{id} |
Delete gateway auth configuration | Example |
# Create API Gateway authentication configuration
auth_config = {
"name": "my-api-gateway-auth",
"type": "BEARER",
"enabled": True,
"config": {
"headerName": "Authorization",
"headerPrefix": "Bearer",
"validateToken": True
}
}
config = auth_client.create_gateway_auth_config(auth_config)
config_id = config.get('id')
print(f"Created gateway auth config with ID: {config_id}")# Get gateway auth configuration by ID
config = auth_client.get_gateway_auth_config("config-id-123")
print(f"Config name: {config.get('name')}")
print(f"Config type: {config.get('type')}")
print(f"Enabled: {config.get('enabled')}")# List all gateway auth configurations
configs = auth_client.list_gateway_auth_configs()
for config in configs:
print(f"ID: {config.get('id')}")
print(f"Name: {config.get('name')}")
print(f"Type: {config.get('type')}")
print(f"Enabled: {config.get('enabled')}")
print("---")# Update gateway auth configuration
updated_config = {
"name": "my-api-gateway-auth-updated",
"type": "BEARER",
"enabled": False, # Disable the config
"config": {
"headerName": "X-API-Key",
"headerPrefix": "ApiKey",
"validateToken": True
}
}
config = auth_client.update_gateway_auth_config("config-id-123", updated_config)
print(f"Updated config: {config.get('name')}")# Delete gateway auth configuration
auth_client.delete_gateway_auth_config("config-id-123")
print("Gateway auth config deleted successfully")This section provides detailed information about all the models (data classes) used in authorization APIs.
Represents a user, group, or role that is granted or removed access.
Module: conductor.client.http.models.subject_ref
Properties:
type(str, required): The subject type - one ofUSER,ROLE, orGROUPid(str, required): The identifier of the subject (e.g., user email, group ID, role name)
Subject Types:
USER- An individual user identified by email or user IDROLE- A role nameGROUP- A group identified by group ID
Example:
from conductor.client.http.models.subject_ref import SubjectRef, SubjectType
# User subject
user_subject = SubjectRef(SubjectType.USER, "user@example.com")
# Group subject
group_subject = SubjectRef(SubjectType.GROUP, "engineering-team")
# Role subject
role_subject = SubjectRef(SubjectType.ROLE, "workflow-operator")Represents the object over which access is being granted or removed.
Module: conductor.client.http.models.target_ref
Properties:
type(str, required): The target type (see Target Types below)id(str, required): The identifier of the target resource
Target Types:
WORKFLOW_DEF- Workflow definition (template)WORKFLOW- Workflow execution instanceWORKFLOW_SCHEDULE- Scheduled workflowTASK_DEF- Task definitionTASK_REF_NAME- Task reference nameTASK_ID- Specific task instanceAPPLICATION- ApplicationUSER- UserSECRET_NAME- SecretENV_VARIABLE- Environment variableTAG- TagDOMAIN- DomainINTEGRATION_PROVIDER- Integration providerINTEGRATION- IntegrationPROMPT- AI prompt templateUSER_FORM_TEMPLATE- User form templateSCHEMA- Schema definitionCLUSTER_CONFIG- Cluster configurationWEBHOOK- WebhookAPI_GATEWAY_SERVICE- API Gateway serviceAPI_GATEWAY_SERVICE_ROUTE- API Gateway service route
Example:
from conductor.client.http.models.target_ref import TargetRef, TargetType
# Workflow definition target
workflow_target = TargetRef(TargetType.WORKFLOW_DEF, "order-processing")
# Task definition target
task_target = TargetRef(TargetType.TASK_DEF, "send-email")
# Application target
app_target = TargetRef(TargetType.APPLICATION, "payment-service")
# Secret target
secret_target = TargetRef(TargetType.SECRET_NAME, "db-password")Enum representing the types of access that can be granted.
Module: conductor.client.orkes.models.access_type
Values:
READ- Read access to view the resourceCREATE- Create new instancesUPDATE- Modify existing resourcesEXECUTE- Execute workflows or tasksDELETE- Delete resources
Example:
from conductor.client.orkes.models.access_type import AccessType
# Grant read and execute permissions
permissions = [AccessType.READ, AccessType.EXECUTE]
# Grant full access
full_access = [AccessType.READ, AccessType.CREATE, AccessType.UPDATE, AccessType.EXECUTE, AccessType.DELETE]Represents a metadata tag for categorizing and organizing resources.
Module: conductor.client.orkes.models.metadata_tag
Properties:
key(str, required): The tag key/namevalue(str, required): The tag valuetype(str, auto-set): Always set to "METADATA"
Use Cases:
- Categorize applications by environment (dev, staging, prod)
- Tag resources by team, project, or cost center
- Add custom metadata for organizational purposes
Example:
from conductor.client.orkes.models.metadata_tag import MetadataTag
# Create tags
tags = [
MetadataTag("environment", "production"),
MetadataTag("team", "platform"),
MetadataTag("cost-center", "engineering"),
MetadataTag("version", "2.0")
]
# Apply to application
auth_client.set_application_tags(tags, "my-app-id")Represents an application in the Conductor system.
Module: conductor.client.http.models.conductor_application
Properties:
id(str): Unique application identifiername(str): Application namecreateTime(int): Creation timestamp (epoch millis)createdBy(str): User who created the applicationupdateTime(int): Last update timestampupdatedBy(str): User who last updated the application
Note: Application tags are managed through separate tagging APIs (get_application_tags(), set_application_tags(), delete_application_tags()) and are not included in the ConductorApplication object itself.
Example:
# Get application
app = auth_client.get_application("app-id-123")
print(f"Application: {app.name}")
print(f"Created by: {app.createdBy}")
# Get tags separately
tags = auth_client.get_application_tags("app-id-123")
print(f"Tags: {[f'{tag.key}={tag.value}' for tag in tags] if tags else 'No tags'}")Request model for creating or updating an application.
Module: conductor.client.http.models.create_or_update_application_request
Properties:
name(str, required): Application name (e.g., "Payment Processors")
Example:
from conductor.client.http.models.create_or_update_application_request import CreateOrUpdateApplicationRequest
# Create new application
request = CreateOrUpdateApplicationRequest(name="My Service Application")
app = auth_client.create_application(request)Represents an access key for application authentication.
Module: conductor.client.orkes.models.access_key
Properties:
id(str): Access key IDstatus(str): Key status -ACTIVEorINACTIVEcreateTime(int): Creation timestampcreatedBy(str): User who created the key
Example:
# List access keys
keys = auth_client.get_access_keys("app-id-123")
for key in keys:
print(f"Key ID: {key.id}")
print(f"Status: {key.status}")
print(f"Created: {key.createTime}")Represents a newly created access key (includes the secret).
Module: conductor.client.orkes.models.created_access_key
Properties:
id(str): Access key IDsecret(str): Access key secret (ONLY available at creation time!)
secret field is only returned when the access key is first created. You must save it immediately as it cannot be retrieved later!
Example:
# Create access key
created_key = auth_client.create_access_key("app-id-123")
# SAVE THESE IMMEDIATELY - secret is only shown once!
key_id = created_key.id
key_secret = created_key.secret
print(f"Key ID: {key_id}")
print(f"Secret: {key_secret}") # Save this securely!Represents a user in the Conductor system.
Module: conductor.client.http.models.conductor_user
Properties:
id(str): User ID (usually email)name(str): Full nameroles(List[str]): Assigned rolesgroups(List[str]): Group membershipsapplicationUser(bool): Whether this is an application usernamespace(str): User namespaceuuid(str): Unique user identifiercontactInformation(Dict[str, str]): User contact information (email, phone, etc.)
Example:
# Get user
user = auth_client.get_user("user@example.com")
print(f"Name: {user.name}")
print(f"Roles: {user.roles}")
print(f"Groups: {user.groups}")
print(f"Namespace: {user.namespace}")
print(f"Contact: {user.contactInformation if user.contactInformation else 'Not provided'}")Request model for creating or updating a user.
Module: conductor.client.http.models.upsert_user_request
Properties:
name(str, required): User's full nameroles(List[str], optional): Roles to assign to the usergroups(List[str], optional): IDs of groups the user belongs to
Available Roles:
USER- Basic user accessADMIN- Full administrative accessMETADATA_MANAGER- Manage workflow/task definitionsWORKFLOW_MANAGER- Manage workflow executionsWORKER- Worker task execution access
Example:
from conductor.client.http.models.upsert_user_request import UpsertUserRequest
# Create user request
request = UpsertUserRequest(
name="John Doe",
roles=["USER", "WORKFLOW_MANAGER"],
groups=["engineering-team", "ops-team"]
)
user = auth_client.upsert_user(request, "john.doe@example.com")Represents a user group in the Conductor system.
Module: conductor.client.http.models.group
Properties:
id(str): Group IDdescription(str): Group descriptionroles(List[str]): Roles assigned to the groupdefaultAccess(Dict): Default access permissions for the groupcontactInformation(Dict): Group contact information
Example:
# Get group
group = auth_client.get_group("engineering-team")
print(f"Description: {group.description}")
print(f"Roles: {group.roles}")Request model for creating or updating a group.
Module: conductor.client.http.models.upsert_group_request
Properties:
description(str, required): Description of the grouproles(List[str], optional): Roles to assign to the groupdefaultAccess(Dict, optional): Default Map<TargetType, Set> to share permissions- Allowed target types:
WORKFLOW_DEF,TASK_DEF,WORKFLOW_SCHEDULE
- Allowed target types:
Example:
from conductor.client.http.models.upsert_group_request import UpsertGroupRequest
# Create group with default access
request = UpsertGroupRequest(
description="Engineering Team",
roles=["USER", "WORKFLOW_MANAGER"],
defaultAccess={
"WORKFLOW_DEF": ["READ", "EXECUTE"],
"TASK_DEF": ["READ"]
}
)
group = auth_client.upsert_group(request, "engineering-team")Represents a granted permission showing the target and access levels.
Module: conductor.client.orkes.models.granted_permission
Properties:
target(TargetRef): The resource the permission applies toaccess(List[AccessType]): The types of access granted
Example:
# Get user permissions
permissions = auth_client.get_granted_permissions_for_user("user@example.com")
for perm in permissions:
print(f"Target: {perm.target.type}:{perm.target.id}")
print(f"Access: {[access.name for access in perm.access]}")Request model for granting or removing permissions.
Module: Internal model used by API
Properties:
subject(SubjectRef, required): The subject being granted/removed accesstarget(TargetRef, required): The target resourceaccess(List[AccessType], required): The access types to grant/remove
Example:
# This is handled internally by grant_permissions() and remove_permissions()
from conductor.client.http.models.target_ref import TargetRef, TargetType
from conductor.client.http.models.subject_ref import SubjectRef, SubjectType
from conductor.client.orkes.models.access_type import AccessType
target = TargetRef(TargetType.WORKFLOW_DEF, "my-workflow")
subject = SubjectRef(SubjectType.USER, "user@example.com")
access = [AccessType.READ, AccessType.EXECUTE]
auth_client.grant_permissions(subject, target, access)Represents a role with associated permissions.
Properties:
name(str): Role namepermissions(List[Dict]): List of permissions- Each permission has:
resource(str): Resource type (e.g., "WORKFLOW_DEF")actions(List[str]): Allowed actions (e.g., ["READ", "EXECUTE"])
- Each permission has:
Example:
# Get role
role = auth_client.get_role("workflow-operator")
print(f"Role: {role['name']}")
print(f"Permissions: {role['permissions']}")Request model for creating or updating a custom role.
Properties:
name(str, required): Role namepermissions(List[Dict], required): List of permission definitions
Example:
# Create custom role
role_request = {
"name": "data-analyst",
"description": "Can read and execute data workflows",
"permissions": [
{
"resource": "WORKFLOW_DEF",
"actions": ["READ", "EXECUTE"]
},
{
"resource": "TASK_DEF",
"actions": ["READ"]
}
]
}
role = auth_client.create_role(role_request)Request model for generating a JWT token.
Properties:
keyId(str, required): Access key IDkeySecret(str, required): Access key secretexpiration(int, optional): Token expiration time in seconds
Example:
# Generate JWT token
token_response = auth_client.generate_token(
key_id="your-key-id",
key_secret="your-key-secret"
)
jwt_token = token_response.get('token')Configuration for API Gateway authentication.
Module: conductor.client.http.models.authentication_config
Properties:
id(str, required): Configuration IDapplicationId(str, required): Associated application IDauthenticationType(str, required): Type of authentication - one of:NONE,API_KEY,OIDCapiKeys(List[str]): List of API keys (when using API_KEY authentication)audience(str): OAuth audienceconductorToken(str): Conductor token for authenticationcreatedBy(str): User who created the configurationfallbackToDefaultAuth(bool): Use default auth as fallbackissuerUri(str): OAuth issuer URI (for OIDC authentication)passthrough(bool): Whether to pass auth throughtokenInWorkflowInput(bool): Include token in workflow inputupdatedBy(str): User who last updated the configuration
Example:
# Create gateway auth config with API_KEY authentication
auth_config = {
"id": "my-gateway-auth",
"authenticationType": "API_KEY",
"applicationId": "app-id-123",
"apiKeys": ["key1", "key2"],
"fallbackToDefaultAuth": False,
"tokenInWorkflowInput": True
}
config = auth_client.create_gateway_auth_config(auth_config)
# Create gateway auth config with OIDC authentication
oidc_config = {
"id": "my-oidc-auth",
"authenticationType": "OIDC",
"applicationId": "app-id-123",
"issuerUri": "https://auth.example.com",
"audience": "https://api.example.com",
"passthrough": True
}
config = auth_client.create_gateway_auth_config(oidc_config)Quick reference for importing all models:
# Core authorization models
from conductor.client.http.models.subject_ref import SubjectRef, SubjectType
from conductor.client.http.models.target_ref import TargetRef, TargetType
from conductor.client.orkes.models.access_type import AccessType
from conductor.client.orkes.models.metadata_tag import MetadataTag
from conductor.client.orkes.models.granted_permission import GrantedPermission
# Access key models
from conductor.client.orkes.models.access_key import AccessKey
from conductor.client.orkes.models.created_access_key import CreatedAccessKey
# User and group models
from conductor.client.http.models.conductor_user import ConductorUser
from conductor.client.http.models.upsert_user_request import UpsertUserRequest
from conductor.client.http.models.group import Group
from conductor.client.http.models.upsert_group_request import UpsertGroupRequest
# Application models
from conductor.client.http.models.conductor_application import ConductorApplication
from conductor.client.http.models.create_or_update_application_request import CreateOrUpdateApplicationRequestHere's a complete example showing how to set up RBAC for a workflow:
from conductor.client.configuration.configuration import Configuration
from conductor.client.orkes.orkes_authorization_client import OrkesAuthorizationClient
from conductor.client.http.models.upsert_user_request import UpsertUserRequest
from conductor.client.http.models.upsert_group_request import UpsertGroupRequest
from conductor.client.http.models.target_ref import TargetRef, TargetType
from conductor.client.http.models.subject_ref import SubjectRef, SubjectType
from conductor.client.orkes.models.access_type import AccessType
# Initialize
configuration = Configuration()
auth_client = OrkesAuthorizationClient(configuration)
# 1. Create users
developer = auth_client.upsert_user(
UpsertUserRequest(name="Developer User", roles=["USER"]),
"developer@example.com"
)
operator = auth_client.upsert_user(
UpsertUserRequest(name="Operator User", roles=["USER"]),
"operator@example.com"
)
# 2. Create group
engineering = auth_client.upsert_group(
UpsertGroupRequest(description="Engineering Team", roles=["USER"]),
"engineering-team"
)
# 3. Add users to group
auth_client.add_users_to_group("engineering-team", [
"developer@example.com",
"operator@example.com"
])
# 4. Grant permissions to group on workflow
workflow_target = TargetRef(TargetType.WORKFLOW_DEF, "order-processing")
group_subject = SubjectRef(SubjectType.GROUP, "engineering-team")
auth_client.grant_permissions(
group_subject,
workflow_target,
[AccessType.READ, AccessType.EXECUTE]
)
# 5. Grant additional permissions to developer
developer_subject = SubjectRef(SubjectType.USER, "developer@example.com")
auth_client.grant_permissions(
developer_subject,
workflow_target,
[AccessType.UPDATE] # Developers can also modify
)
# 6. Verify permissions
permissions = auth_client.get_permissions(workflow_target)
print("Workflow permissions:")
for access_type, subjects in permissions.items():
print(f" {access_type}:")
for subject in subjects:
print(f" - {subject.type}: {subject.id}")
# 7. Check specific user permissions
can_update = auth_client.check_permissions(
user_id="developer@example.com",
target_type="WORKFLOW_DEF",
target_id="order-processing"
)
print(f"Developer can update: {can_update}")-
Principle of Least Privilege: Grant only the minimum permissions required for users/groups to perform their tasks.
-
Use Groups: Assign permissions to groups rather than individual users for easier management.
-
Secure Access Keys:
- Store access key secrets securely (they're only shown once at creation)
- Rotate access keys regularly
- Use inactive status instead of deletion when temporarily revoking access
-
Audit Regularly: Use
get_granted_permissions_for_user()andget_granted_permissions_for_group()to audit access. -
Role-Based Organization:
- Use system roles for standard permissions
- Create custom roles for specific use cases
- Document custom role purposes
-
Testing: Always verify permissions with
check_permissions()before granting production access. -
Cleanup: Remove unused users, groups, and applications to maintain security.
All authorization methods may raise exceptions. Always use proper error handling:
from conductor.client.http.rest import RestException
try:
user = auth_client.get_user("user@example.com")
except RestException as e:
if e.status == 404:
print("User not found")
elif e.status == 403:
print("Access denied")
else:
print(f"Error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")For a comprehensive implementation that demonstrates all authorization APIs in a single, cohesive narrative, see:
π examples/authorization_journey.py
This complete example includes:
β
All 49 Authorization APIs - 100% coverage with proper model classes
β
Real-World Scenario - E-commerce platform RBAC setup
β
Progressive Learning - 12 chapters building on each other
β
Update Operations - Demonstrates CREATE, READ, UPDATE, DELETE for all entities
β
Custom Roles - Creating and managing custom roles with actual permissions
β
Error Handling - Graceful fallbacks and clear error messages
β
Cleanup - Automatic resource cleanup (can be disabled with --no-cleanup)
# Standard execution with automatic cleanup
python3 examples/authorization_journey.py
# Keep resources for inspection
python3 examples/authorization_journey.py --no-cleanup
# Run as pytest
python3 -m pytest examples/authorization_journey.py -vSee examples/authorization_coverage.md for detailed verification that all APIs are covered.