-
Notifications
You must be signed in to change notification settings - Fork 85
feat: add docs about source of truth #1002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
419a912
feat: add docs about source of truth
aaguiarz 67d473a
chore: adjusted narrative
aaguiarz fa95634
chore: disabled link checking
aaguiarz 5db86f7
chore: fixed link
aaguiarz 60f00d4
Update docs/content/best-practices/source-of-truth.mdx
aaguiarz c37b716
Merge branch 'main' into feat/source-of-truth
aaguiarz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: Source of Truth | ||
sidebar_position: 3 | ||
slug: /best-practices/source-of-truth | ||
description: Deciding where to store the "source of truth" for authorization data | ||
--- | ||
|
||
import { | ||
ProductName, | ||
ProductNameFormat, | ||
RelatedSection, | ||
|
||
} from '@components/Docs'; | ||
|
||
# Storing the "source of truth" for authorization data | ||
|
||
<ProductName format={ProductNameFormat.ShortForm}/> is inspired by [Google’s Zanzibar](https://research.google/pubs/zanzibar-googles-consistent-global-authorization-system/). In Google’s architecture, Zanzibar is an extremely efficient system for authorization checks—but it's never the source of truth for application data. The [Read endpoint](https://openfga.dev/docs/interacting/relationship-queries#read) is mostly used when you need to inspect the stored data, like troubleshooting consistency issues. | ||
|
||
For developers building with <ProductName format={ProductNameFormat.ShortForm}/> , following Google's approach isn't always practical. In most cases, applications will use <ProductName format={ProductNameFormat.ShortForm}/> as the source of truth for some data, but not for everything. | ||
|
||
**When <ProductName format={ProductNameFormat.ShortForm}/> is not the right source of truth:** | ||
|
||
- User data: Your user directory (profiles, groups, attributes like manager or department) typically lives in your identity provider. In SaaS apps, this is often your customer's IdP. | ||
- Entity hierarchies: Structures like project/tickets or folder/documents already live in your app's database. Repeatedly querying OpenFGA just to navigate that hierarchy would be inefficient. | ||
- Search and filtering: When performing searches, you need to combine data that's on your database and data that's in OpenFGA. Your application's database is the right place to do filtering/sorting/joins. That data should be present on your database. | ||
|
||
**When OpenFGA is a good source of truth:** | ||
|
||
- Fine-grained permissions: If your app allows users to assign permissions directly to resources (e.g., sharing a document), and you don't already store that data, OpenFGA works well as the source of truth. | ||
|
||
- Role membership: If you are not using another system to manage roles, storing role membership in OpenFGA is reasonable. Just remember that OpenFGA does not store role metadata (like names or descriptions), so you'll still need a 'Roles' table in your app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.