What are FusionAuth entities good for?
-
I'm curious about entities. What are they good for?
-
Entities are one of the most flexible parts of FusionAuth and can be used to represent links and/or permissions between domain objects and users.
Entity types are like classes in an object-oriented programming language, which define the permissions that an entity can have.
Entities are similar to objects, in that they are an instantiation of an entity type. No behavior though, and no inheritance.
Entities are connected to users and other entities via grants. You can think of this setting up a directed permission graph that can be traced.
0 to N permissions are attached to each grant.
There are three major uses for entities:
- the client credentials grant (agentic, machine to machine or service account authentication)
- building limited fine grain authentication (FGA-ish) systems that don't need full ReBAC, but do want to use a permission graph or dynamically add and remove permissions
- modelling permissions on something you don't log into
A few notes about entities:
- you'll want to get familiar with the API or the client libraries; entities are managed in code. Both in creating the graph and reading it from your application.
- each entity has a data field which can handle arbitrary JSON and is searchable
- the graph can be cyclic if you make bidirectional grants between entities. Users cannot accept grants, they can only be granted permissions to entities.
- if you need full ReBAC or ABAC, you want FusionAuth FGA. More functionality, including automatic relationship graph traversal. The downside is you have to sync data and run a separate service.
-
D dan has marked this topic as solved