Pure.Authorization.OpenFGA.Model.Abstractions 0.1.0-preview.0.1.0

This is a prerelease version of Pure.Authorization.OpenFGA.Model.Abstractions.
dotnet add package Pure.Authorization.OpenFGA.Model.Abstractions --version 0.1.0-preview.0.1.0
                    
NuGet\Install-Package Pure.Authorization.OpenFGA.Model.Abstractions -Version 0.1.0-preview.0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pure.Authorization.OpenFGA.Model.Abstractions" Version="0.1.0-preview.0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pure.Authorization.OpenFGA.Model.Abstractions" Version="0.1.0-preview.0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Pure.Authorization.OpenFGA.Model.Abstractions" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Pure.Authorization.OpenFGA.Model.Abstractions --version 0.1.0-preview.0.1.0
                    
#r "nuget: Pure.Authorization.OpenFGA.Model.Abstractions, 0.1.0-preview.0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Pure.Authorization.OpenFGA.Model.Abstractions@0.1.0-preview.0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Pure.Authorization.OpenFGA.Model.Abstractions&version=0.1.0-preview.0.1.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Pure.Authorization.OpenFGA.Model.Abstractions&version=0.1.0-preview.0.1.0&prerelease
                    
Install as a Cake Tool

Pure.Authorization.OpenFGA.Model.Abstractions

OpenFGA authorization model interfaces for the Pure ecosystem — immutable, composable abstractions over objects, subjects, tuples, type definitions, relation rewrites and conditions.

.NET build & test Build and Deploy NuGet License: MIT

Overview

Pure.Authorization.OpenFGA.Model.Abstractions defines a set of minimal, read-only interfaces that describe an OpenFGA authorization model and the relationship tuples written against it. Each interface exposes only getters — no mutation, no side effects. All string properties are typed as IString from Pure.Primitives.Abstractions, keeping the model decoupled from concrete string representations and from any particular OpenFGA client SDK.

Interfaces

Each concept lives in its own folder and namespace under Pure.Authorization.OpenFGA.Model.Abstractions.

Interface Namespace Description
IAuthorizationModel .Model Root model — schema version, type definitions and conditions
ITypeDefinition .Model Object type — name and the relations defined on it
IRelationDefinition .Model Relation — name and the rewrite that defines it
IRewrite .Rewrite Base of the relation-definition expression tree (closed set of nodes)
IDirect .Rewrite Directly assignable — [user, group#member]
IComputedRelation .Rewrite Another relation on the same object — editor
IRelationFrom .Rewrite A relation on related objects — viewer from parent
IUnion .Rewrite Any of the children — a or b
IIntersection .Rewrite All of the children — a and b
IDifference .Rewrite Base minus subtracted part — a but not b
ISubjectForm .SubjectForm Base of the forms a relation can be written for directly (closed set)
ITypeForm .SubjectForm Any object of a type — user
ISubjectSetForm .SubjectForm Holders of a relation on a type — group#member
IWildcardForm .SubjectForm Every object of a type — user:*
IConditionalForm .SubjectForm A non-conditional form plus a condition name — user with non_expired
ICondition .Condition ABAC condition — name, CEL expression and parameters
IConditionParameter .Condition Condition parameter — name and type
IConditionParameterType .Condition Parameter type — name and generic type arguments (list<string>)
ISubject .Subject Base of the subjects of a tuple (closed set)
ISubjectSet .Subject Holders of a relation on an object — group:1#member
ITypedWildcard .Subject Every object of a type — user:*
IObject .Object Object — type and id, document:1; also usable as a subject
ITuple .Tuple Relationship tuple — subject, relation and object
IConditionalTuple .Tuple A tuple decorated with a relationship condition
IRelationshipCondition .Tuple Condition name and JSON context stored with a tuple

IRewrite, ISubjectForm and ISubject have no members: each is the base of a closed set of variants, and consumers pattern-match on the concrete interface.

OpenFGA Naming

Names follow the OpenFGA DSL rather than the JSON/API wire format. Where they differ:

This package OpenFGA JSON / API
ISubject user (the left-hand side of a tuple)
ISubjectSet userset (type:id#relation)
ITypedWildcard TypedWildcard (type:*)
IRewrite Userset
IDirect this + directly_related_user_types
IComputedRelation computedUserset
IRelationFrom tupleToUserset (Tupleset = tupleset.relation, Relation = computedUserset.relation)
ISubjectForm RelationReference (an entry of directly_related_user_types)
ITuple TupleKey
IRelationshipCondition RelationshipCondition

Design Principles

  • Immutable — all interfaces expose only get properties; no setters, no methods that mutate state.
  • Composable — complex structure is expressed through composition and IEnumerable<T> collections, allowing traversal without committing to a concrete collection type.
  • Primitive-typed — string properties use IString from Pure.Primitives.Abstractions, not System.String, keeping the model framework-agnostic.
  • AOT-compatible — the library sets IsAotCompatible=true and contains no reflection or code generation.

Dependencies

Target Frameworks

  • .NET 7
  • .NET 8
  • .NET 9
  • .NET 10

Installation

dotnet add package Pure.Authorization.OpenFGA.Model.Abstractions

Usage

The closed sets (IRewrite, ISubjectForm, ISubject) are consumed by pattern matching. For example, rendering a relation definition back to the OpenFGA DSL:

using System.Linq;
using Pure.Authorization.OpenFGA.Model.Abstractions.Rewrite;
using Pure.Authorization.OpenFGA.Model.Abstractions.SubjectForm;

static string Dsl(IRewrite rewrite) =>
    rewrite switch
    {
        IDirect direct => $"[{string.Join(", ", direct.Forms.Select(FormDsl))}]",
        IComputedRelation computed => computed.Relation.TextValue,
        IRelationFrom from => $"{from.Relation.TextValue} from {from.Tupleset.TextValue}",
        IUnion union => $"({string.Join(" or ", union.Children.Select(Dsl))})",
        IIntersection both => $"({string.Join(" and ", both.Children.Select(Dsl))})",
        IDifference diff => $"({Dsl(diff.Base)} but not {Dsl(diff.Subtract)})",
        _ => throw new NotSupportedException(rewrite.GetType().Name),
    };

static string FormDsl(ISubjectForm form) =>
    form switch
    {
        ITypeForm type => type.Type.TextValue,
        ISubjectSetForm set => $"{set.Type.TextValue}#{set.Relation.TextValue}",
        IWildcardForm wildcard => $"{wildcard.Type.TextValue}:*",
        IConditionalForm conditional =>
            $"{FormDsl(conditional.Form)} with {conditional.Condition.TextValue}",
        _ => throw new NotSupportedException(form.GetType().Name),
    };
Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (4)

Showing the top 4 NuGet packages that depend on Pure.Authorization.OpenFGA.Model.Abstractions:

Package Downloads
Pure.Authorization.OpenFGA.Model.Conditions

Package Description

Pure.Authorization.OpenFGA.Model.HashCodes

Package Description

Pure.Authorization.OpenFGA.Model

Package Description

Pure.Authorization.OpenFGA.Model.Abstractions.Serialization.System

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-preview.0.1.0 202 10/22/2026