IAM Fundamentals
Identity and Access Management (IAM) is a fundamental security framework that controls who can access what resources in your application and what actions they can perform. Understanding IAM concepts is crucial for implementing secure, scalable access control systems.
What is IAM?
Section titled “What is IAM?”IAM encompasses two core security functions:
Authentication
Section titled “Authentication”“Who are you?” - Verifying the identity of users, services, or systems
- Login credentials (username/password)
- Multi-factor authentication (MFA)
- OAuth providers (Google, GitHub, etc.)
- API keys and tokens
- Biometric verification
Authorization
Section titled “Authorization”“What can you do?” - Determining what authenticated entities are allowed to access
- Permission checking
- Access control policies
- Resource-level restrictions
- Role-based access control (RBAC)
Core IAM Components
Section titled “Core IAM Components”1. Identity (Principal)
Section titled “1. Identity (Principal)”An identity (also called a principal) represents an entity that can be authenticated and granted permissions. Identities include:
Real people with accounts in your system:
{ "id": "user_12345", "email": "alice@company.com", "name": "Alice Johnson", "type": "user"}Service Accounts
Section titled “Service Accounts”Applications or automated systems:
{ "id": "service_backup_system", "name": "Backup Service", "type": "service_account"}API Keys
Section titled “API Keys”Programmatic access tokens:
{ "id": "api_key_67890", "name": "Mobile App API Key", "type": "api_key"}Groups/Teams
Section titled “Groups/Teams”Collections of users:
{ "id": "group_engineering", "name": "Engineering Team", "members": ["user_12345", "user_67890"], "type": "group"}2. Resources
Section titled “2. Resources”Resources are the objects, data, or services you want to protect. Everything that requires access control is a resource.
Physical Resources
Section titled “Physical Resources”- Servers and infrastructure
- Database instances
- Storage systems
- Network devices
Digital Resources
Section titled “Digital Resources”- Files and documents
- Database records
- API endpoints
- Applications and services
Logical Resources
Section titled “Logical Resources”- Projects and workspaces
- Organizations and teams
- Workflows and processes
- Configurations and settings
Resource Identification
Section titled “Resource Identification”Resources are identified using Resource URIs - hierarchical identifiers that uniquely specify each resource:
/organization/acme├── /organization/acme/project/web-app│ ├── /organization/acme/project/web-app/environment/production│ ├── /organization/acme/project/web-app/environment/staging│ └── /organization/acme/project/web-app/database/users├── /organization/acme/project/mobile-app│ ├── /organization/acme/project/mobile-app/api/v1│ └── /organization/acme/project/mobile-app/api/v2└── /organization/acme/billing ├── /organization/acme/billing/invoices └── /organization/acme/billing/payments3. Permissions
Section titled “3. Permissions”Permissions define specific actions that can be performed on resources. They represent the most granular level of access control.
Action-Based Permissions
Section titled “Action-Based Permissions”document.read - View document contentdocument.write - Create or modify documentsdocument.delete - Remove documentsdocument.share - Share documents with othersCRUD Operations
Section titled “CRUD Operations”create - Add new resourcesread - View existing resourcesupdate - Modify existing resourcesdelete - Remove resourcesAdministrative Permissions
Section titled “Administrative Permissions”admin.users.create - Create new user accountsadmin.users.suspend - Suspend user accountsadmin.billing.view - View billing informationadmin.logs.access - Access system logsDomain-Specific Permissions
Section titled “Domain-Specific Permissions”deploy.staging - Deploy to staging environmentdeploy.production - Deploy to production environmentdatabase.backup - Create database backupssupport.tickets - Access support tickets4. Roles
Section titled “4. Roles”Roles are collections of permissions that can be assigned as a group. They simplify access management by grouping related permissions together.
Predefined Roles
Section titled “Predefined Roles”Viewer Role
{ "name": "viewer", "description": "Read-only access to resources", "permissions": [ "read", "list", "view" ]}Editor Role
{ "name": "editor", "description": "Can view and modify resources", "permissions": [ "read", "write", "update", "create" ]}Admin Role
{ "name": "admin", "description": "Full control over resources", "permissions": [ "read", "write", "update", "create", "delete", "manage", "configure" ]}Custom Roles
Section titled “Custom Roles”Create roles specific to your application’s needs:
Content Manager
{ "name": "content_manager", "description": "Manages content creation and publication", "permissions": [ "content.create", "content.edit", "content.publish", "content.review", "media.upload" ]}DevOps Engineer
{ "name": "devops_engineer", "description": "Manages infrastructure and deployments", "permissions": [ "deploy.staging", "deploy.production", "infrastructure.configure", "monitoring.access", "logs.view" ]}5. Policies
Section titled “5. Policies”Policies define the rules that govern access control. They specify which principals can perform which actions on which resources under what conditions.
Basic Policy Structure
Section titled “Basic Policy Structure”{ "principal": "user_alice", "resource": "/project/web-app/database/users", "permissions": ["read", "write"], "effect": "allow"}Conditional Policies
Section titled “Conditional Policies”{ "principal": "group_developers", "resource": "/project/*/environment/staging", "permissions": ["deploy"], "effect": "allow", "conditions": { "time_of_day": "09:00-17:00", "source_ip": "10.0.0.0/8" }}IAM Models
Section titled “IAM Models”1. Discretionary Access Control (DAC)
Section titled “1. Discretionary Access Control (DAC)”Resource owners control access to their resources:
- User-controlled: Individual users set permissions
- Flexible: Easy to share and delegate access
- Scalability issues: Difficult to manage at scale
- Security risks: Users may grant excessive permissions
Example: File system permissions where file owners can set read/write permissions for other users.
2. Mandatory Access Control (MAC)
Section titled “2. Mandatory Access Control (MAC)”System-wide policies control access:
- Centrally controlled: Administrators set all permissions
- Security focused: Strong security guarantees
- Inflexible: Difficult to adapt to changing needs
- Complex: Requires detailed security classifications
Example: Military security systems with Top Secret, Secret, and Confidential classifications.
3. Role-Based Access Control (RBAC)
Section titled “3. Role-Based Access Control (RBAC)”Access based on user roles within the organization:
- Role-centric: Permissions assigned to roles, not individuals
- Scalable: Easy to manage large numbers of users
- Organizational alignment: Reflects real-world job functions
- Standard approach: Widely adopted in business applications
RBAC Components
Section titled “RBAC Components”Users ──→ Roles ──→ Permissions ──→ Objects/Resources │ └─────→ Sessions ──→ RolesUsers → assigned to → Roles → granted → Permissions → on → Resources
RBAC Example
Section titled “RBAC Example”Alice (User) → Editor Role → [read, write, publish] → /blog/posts/*Bob (User) → Viewer Role → [read] → /blog/posts/*Carol (User) → Admin Role → [read, write, delete, manage] → /blog/*4. Attribute-Based Access Control (ABAC)
Section titled “4. Attribute-Based Access Control (ABAC)”Dynamic access based on attributes:
- Context-aware: Considers user, resource, and environmental attributes
- Fine-grained: Very precise access control
- Complex: Requires sophisticated policy engines
- Flexible: Adapts to complex business rules
ABAC Example
Section titled “ABAC Example”{ "policy": "Allow access if user is manager AND resource is in their department AND current time is business hours", "user_attributes": { "role": "manager", "department": "engineering", "clearance_level": "3" }, "resource_attributes": { "department": "engineering", "classification": "internal", "data_type": "source_code" }, "environment_attributes": { "time": "14:30", "day_of_week": "Tuesday", "location": "office_network" }}Permission Inheritance and Hierarchies
Section titled “Permission Inheritance and Hierarchies”Hierarchical Resources
Section titled “Hierarchical Resources”Resources often exist in hierarchical relationships where permissions granted at higher levels automatically apply to lower levels:
/organization/acme ← Admin permissions here├── /organization/acme/project/web ← apply to all projects│ ├── /environment/staging ← and all environments│ └── /environment/production ← within those projects└── /organization/acme/project/api ├── /environment/staging └── /environment/productionInheritance Rules
Section titled “Inheritance Rules”Systems differ in how they combine inherited and explicit grants. Some support explicit denies or “closest parent wins” rules.
Inheritance Example
Section titled “Inheritance Example”Given these permission assignments:
[ { "principal": "alice", "resource": "/organization/acme", "permissions": ["read"] }, { "principal": "alice", "resource": "/organization/acme/project/web", "permissions": ["write"] },]Alice’s effective permissions:
/organization/acmeand everything beneath it: read/organization/acme/project/weband everything beneath it: read + write (inherited + explicit)
Best Practices
Section titled “Best Practices”1. Principle of Least Privilege
Section titled “1. Principle of Least Privilege”Grant the minimum permissions necessary for users to perform their job functions:
// Good: Specific permissions{ "role": "content_editor", "permissions": [ "articles.create", "articles.edit", "articles.publish", "media.upload" ]}
// Avoid: Overly broad permissions{ "role": "content_editor", "permissions": [ "admin.*", "system.*" ]}2. Role-Based Organization
Section titled “2. Role-Based Organization”Design roles that mirror your organization structure:
{ "engineering_roles": [ "software_engineer", "senior_engineer", "engineering_manager", "principal_engineer" ], "product_roles": [ "product_manager", "product_owner", "product_analyst" ], "operations_roles": [ "devops_engineer", "site_reliability_engineer", "system_administrator" ]}3. Resource Hierarchy Design
Section titled “3. Resource Hierarchy Design”Create logical resource hierarchies that support inheritance:
# Good: Logical hierarchy/company/departments/engineering/teams/platform/projects/auth-service
# Avoid: Flat structure/auth-service-engineering-platform-team4. Regular Access Reviews
Section titled “4. Regular Access Reviews”Implement periodic reviews of permissions:
- Quarterly access reviews: Review all role assignments
- Project completion: Remove project-specific access
- Role changes: Update permissions when people change roles
- Offboarding: Immediately revoke all access when people leave
5. Audit and Logging
Section titled “5. Audit and Logging”Track all access control decisions:
{ "timestamp": "2024-01-15T10:30:00Z", "principal": "alice@company.com", "resource": "/project/web-app/database/users", "action": "read", "result": "allowed", "reason": "role:database_reader"}6. Separation of Duties
Section titled “6. Separation of Duties”Prevent conflicts of interest by separating incompatible functions:
// Finance roles - separate creation from approval{ "expense_creator": ["expense.create", "expense.submit"], "expense_approver": ["expense.approve", "expense.reject"], "expense_payer": ["payment.create", "payment.execute"]}
// Development roles - separate development from production{ "developer": ["code.write", "deploy.staging"], "release_manager": ["deploy.production", "rollback.production"]}Conclusion
Section titled “Conclusion”Effective IAM is critical for application security and requires careful planning and implementation. Key takeaways:
- Start simple: Begin with basic RBAC and expand as needed
- Think hierarchically: Design resource structures that support inheritance
- Follow best practices: Implement least privilege, separation of duties, and regular reviews
- Monitor continuously: Track access patterns and audit permissions regularly
- Choose the right tools: Select IAM solutions that fit your architecture and scale
Ready to try it? The Quickstart takes you from sign-up to a working permission check.
Permio, permissions as a service