auth0

package
v0.269.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Auth0 event samples

samples/*.json are example payloads for the 21 Auth0 Events event types, one file per type, named after the type. They were derived from the JSON Schemas published at https://auth0.com/docs/events and trimmed to the fields a mapping actually addresses: data.object, data.previous_object for *.updated, and the envelope's a0tenant, which is where a recipe reads the tenant from. data.context.tenant is also in the samples, but Auth0 makes data.context optional and a0tenant required, so no recipe depends on it.

They exist so the ofga mappings workspace can preview a rule against a realistic event without network access. They are illustrative, not normative — consult the Auth0 documentation for the authoritative schema.

In the *.updated samples, data.previous_object differs from data.object in exactly one field, except organization.connection.updated. A recipe for an update event is gated on something having changed, so a sample whose two halves are identical would preview as nothing at all — the screen would say the recipe produces no tuple, which is true of that payload and false of the recipe. organization.connection.updated is the exception because its recipe is gated on the value of is_enabled, not on a change, so its two halves are equal and it still previews.

The model

model.fga is one authorization model covering every event here, embedded and returned by Model(). Each recipe also declares the slice of it that recipe needs, which is what the recipe screen shows; this file is their union, in a form you can write to disk. recipes_test.go lints every recipe against it, checks it satisfies every declared requirement, and rejects a relation no recipe uses.

To refresh a sample, replace the file and keep the CloudEvents envelope keys (specversion, type, source, id, time, data, a0tenant, a0stream) in that order. catalog_test.go enforces that every catalog entry has a file, every file is valid JSON with a matching type, and no orphan files exist.

Documentation

Overview

Package auth0 carries a catalog of Auth0 Events event types and an example payload for each, embedded so the `ofga mappings` workspace can preview a rule without network access. See README.md for provenance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Model

func Model() string

Model is an authorization model every recipe in this catalog lints against: one file covering all twenty-one events rather than a fragment per event.

The recipes each declare the slice of it they need, which is what the recipe screen shows you. This is the other half of that — the union, in a form you can write to disk and hand to `ofga model write`.

Types

type Event

type Event struct {
	Type    string
	Group   string
	Summary string
	Sample  map[string]any
	Recipe  Recipe
}

Event is one catalog entry: the event type, the group it is filed under in the picker, a one-line summary, and the decoded example payload.

func Catalog

func Catalog() []Event

Catalog returns every known event type, in picker order. The samples are decoded once, on first use, and every call returns the same slice. It is shared and read-only: a caller that edits a sample or a recipe's rule must copy it first.

func Lookup

func Lookup(typ string) (Event, bool)

Lookup returns the catalog entry for typ.

type Recipe

type Recipe struct {
	Explain string
	// Note is the short reason a recipe maps nothing, for the event picker's
	// row. Mapped recipes leave it empty: their row counts what the rule
	// produces, which is the more useful thing to know about them.
	//
	// Short is a hard constraint, not a preference: the row is the event type
	// plus this, and the longest type is organization.connection.updated, which
	// leaves a third of a narrow picker. A note that has to be truncated to fit
	// cannot do the explaining it is here for.
	//
	// It exists because the count alone cannot say whose fault an empty one is.
	// A row reading "user.created · no tuples" beside a status bar reading "4
	// types" was read as the loaded model coming up short, which sent the user
	// looking for the missing type. Nothing is missing — the event carries no
	// relationship — and the row now says so before it is picked rather than on
	// the screen after.
	Note string
	// Warn is a gap this recipe leaves, shown beside the rule rather than
	// buried in Explain. These are the failures a user discovers in
	// production: an event Auth0 never sends, a tuple the rule cannot reach,
	// or a case it deliberately skips. A recipe with no such gap leaves it
	// empty.
	Warn     string
	Rule     mapping.Rule
	Requires []mapping.Requirement
}

Recipe is what the workspace knows about mapping one event: the rule it pre-loads, the model that rule assumes, and the sentences explaining the pairing. A recipe is teaching material first and a starting point second — the user edits it after loading, so it must be correct rather than clever.

Every event has a Recipe. An event that implies no relationship change has one whose Rule is empty and whose Explain says why: "no mapping" is a lesson, not a missing entry.

func (Recipe) Maps

func (r Recipe) Maps() bool

Maps reports whether this recipe produces anything. It is the single test the recipe screen branches on, so the two empty classes cannot drift apart from the events that belong to them.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL