IAM (Identity & Access Management)
Identity and Access Management (IAM) in Hantera provides a comprehensive system for managing identities, roles, and permissions. IAM is the foundation for authentication and authorization across all Hantera services.
What is IAM?
IAM manages three core concepts:
- Identities - Who can access the system (principals and clients)
- Roles - What permissions identities have
- Sessions - Active authentication sessions
IAM provides REST APIs for creating and managing these entities, while the Graph API provides read access for querying identities.
Identity Types
Hantera supports three types of identities:
Principal
A principal represents a human identity that authenticates with Hantera.
Key characteristics:
- Email address (used as username, must be unique)
- Password or OAuth authentication
- Can be assigned multiple roles
- Can be temporarily suspended
- Dynamic properties for custom data
When to use:
- Portal users (administrators, staff)
- Customer accounts
- Partner or vendor users
- Any human that needs to log in
Learn more: Principals Documentation
Client
A client represents an application or service identity for OAuth and API access.
Key characteristics:
- OAuth configuration (redirect URIs, grant types, scopes)
- Client secret authentication
- No password-based login
- System clients are protected from modification
When to use:
- Third-party integrations
- Mobile or web applications
- Service-to-service communication
- Webhook consumers
Learn more: Clients Documentation
Roles and Permissions
Built-in System Roles
Hantera provides built-in roles that use the system: namespace:
system:owner
Full administrative access to all Hantera resources and operations.
Capabilities:
- Manage all identities, roles, and permissions
- Access all resources without restrictions
- Configure system settings
- Perform destructive operations
system:portal:full
Complete access to the Hantera Portal and portal-managed resources.
Capabilities:
- Access all portal features
- Manage orders, customers, products
- View analytics and reports
- Configure portal settings
Typical users:
- Portal administrators
- Customer service managers
- Operations staff
Custom Roles
You can define custom roles with any namespace except system:.
Role naming pattern:
{namespace}:{capability}Examples:
store:manager- Store management permissionssupport:agent- Customer support accesswarehouse:operator- Warehouse operationsreporting:viewer- Read-only reporting access
Custom role definition:
{ "key": "support:agent", "description": "Customer support representative", "acl": { "entries": [ { "resource": "actors", "permission": "*" }, { "resource": "graph", "permission": "*" }, { "resource": "registry", "permission": "read" } ] }}Role-Based Categorization
Roles serve dual purposes in Hantera:
- Authorization - Define what an identity can do
- Categorization - Group identities by function
This means you can filter identities by role prefix to create semantic groups:
// Get all portal usersGET /resources/iam/principals?rolePrefix=system:portal:
// Get all support agentsGET /resources/iam/principals?rolePrefix=support:
// Get all store managersGET /resources/iam/principals?rolePrefix=store:This pattern eliminates the need for separate “user type” fields while ensuring categorization always reflects actual permissions.
Authorization Model
Required Permissions
IAM operations require specific permissions:
Principal management:
iam/principals:read # List and get principalsiam/principals:write # Create and update principalsiam/principals:delete # Delete principalsClient management:
iam/clients:read # List and get clientsiam/clients:write # Create and update clientsiam/clients:delete # Delete clientsRole management:
iam/roles:read # List and get rolesiam/roles:write # Create and update custom rolesiam/roles:delete # Delete custom rolesSafe Updates with ETags
IAM APIs use ETags to prevent conflicting updates when multiple users modify the same identity.
Usage:
# 1. Get the identity (response includes ETag header)GET /resources/iam/principals/{id}
# 2. Update with If-Match header using the ETagPUT /resources/iam/principals/{id}If-Match: "etag-value-from-step-1"{ "properties": { ... }}If someone else modified the identity between your GET and PUT, the request will fail with 409 Conflict, preventing you from accidentally overwriting their changes.
API Endpoints Summary
IAM provides REST endpoints organized by resource type:
/resources/iam/principals/*- Principal management (details)/resources/iam/clients/*- Client management (details)/resources/iam/roles/*- Role management
For complete endpoint documentation, request/response formats, and error codes, see the HTTP API Reference.
Quick Start Examples
Creating a Portal User
PUT /resources/iam/principals/{userId}{ "properties": { "name": "John Admin", }, "roles": ["system:portal:full"]}Then generate a temporary password and send via email using the Sendings API.
Creating an OAuth Client
PUT /resources/iam/clients/{clientId}{ "properties": { "name": "Mobile App", "redirectUris": ["myapp://callback"], "grantTypes": ["authorization_code", "refresh_token"] }, "roles": []}Querying Identities
Use the Graph API to query identities:
POST /resources/graph/query{ "resource": "identity", "filters": [ { "field": "roles", "op": "contains", "value": "system:portal:full" } ], "limit": 50}Common Workflows
User Onboarding
-
Create principal
PUT /resources/iam/principals/{id} -
Assign roles
PUT /resources/iam/principals/{id}/roles -
Generate temporary password
POST /resources/iam/principals/{id}/password/reset -
Send welcome email Use Sendings API to send credentials
-
User logs in and changes password
POST /resources/me/password
Application Integration
-
Create OAuth client
PUT /resources/iam/clients/{id} -
Generate client secret
POST /resources/iam/clients/{id}/secrets -
Configure application Use client ID and secret in your OAuth flow
-
Assign necessary roles
PUT /resources/iam/clients/{id}/roles
Next Steps
- Principals Documentation - Deep dive into user management
- Clients Documentation - OAuth clients and service accounts
- Access Control - Permission patterns and best practices
- Graph API - Querying identities
- HTTP API Reference - Complete endpoint documentation
Related Resources
- Identity Graph Node - Query identities via Graph
- Me Endpoint - Current user information and password management
- Sendings API - Send emails (for password resets)
- Authentication Guide - How authentication works in Hantera