TL;DR
This guide breaks down authorization, federation, and entitlement – three key concepts in controlling access to resources. We’ll explain what each one is, how they differ, and when you might use them.
1. Authorization: Are You Allowed?
Authorization determines what a user can do once they’ve been identified (authenticated). Think of it like having a keycard to a building – authentication proves who you are, authorization decides which doors your card opens.
- What it does: Checks permissions.
- Example: A user can view their profile but not edit other users’ profiles.
- Implementation: Often uses Role-Based Access Control (RBAC) or Attribute-Based Access Control (ABAC).
# Example RBAC in Python
user_roles = ['viewer', 'editor']
resource_permissions = {'view': ['viewer'], 'edit': ['editor']}
def check_permission(user, resource, action):
if action in resource_permissions and user in resource_permissions[action]:
return True
else:
return False
print(check_permission('Alice', 'profile', 'view')) # Output: True
2. Federation: Trusting Other Systems
Federation allows users to use credentials from one system (Identity Provider – IdP) to access resources in another system (Service Provider – SP). It’s like using your Google account to log into a third-party website.
- What it does: Establishes trust between different identity systems.
- Example: Logging into an application with your company Microsoft account.
- Protocols: Commonly uses SAML, OAuth 2.0, and OpenID Connect (OIDC).
# Simplified OAuth 2.0 flow
1. User requests access to a resource.
2. Application redirects user to IdP for authentication.
3. User authenticates with IdP.
4. IdP redirects user back to application with an authorization code.
5. Application exchanges the code for an access token.
6. Application uses the access token to access the resource.
3. Entitlement: What Resources Do You Have Access To?
Entitlement defines which specific resources a user has access to, often based on their subscription or license. It’s more granular than authorization.
- What it does: Manages access rights to particular items.
- Example: A premium subscriber can access all features of an application, while a free user has limited access.
- Implementation: Often integrated with billing and subscription systems.
# Example Entitlement check (simplified)
user_subscription = 'premium'
resource_entitlements = {'feature1': ['free', 'premium'], 'feature2': ['premium']}
def has_entitlement(user, resource):
if resource in resource_entitlements and user_subscription in resource_entitlements[resource]:
return True
else:
return False
print(has_entitlement('Bob', 'feature1')) # Output: True
4. Key Differences Summarized
| Feature | Authorization | Federation | Entitlement |
|---|---|---|---|
| Focus | Permissions (what you can do) | Trust between systems | Specific resources (which items you have access to) |
| Scope | Within a single system | Across multiple systems | Granular, often tied to subscriptions |
| Example | Edit profile vs. view profile | Login with Google | Accessing premium features |
5. Putting it All Together
These concepts often work together:
- A user authenticates via federation (e.g., logs in with their company account).
- Once authenticated, the system checks their authorization to determine what actions they are allowed to perform.
- Finally, the system verifies their entitlement to access specific resources based on their subscription or license.
Understanding these differences is crucial for building secure and flexible applications and robust cyber security practices.

