appcatalog

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package appcatalog describes the applications a SystemForge deployment hosts, for the product switcher every application's shell shows: each application's name, where it opens, its icon and its place in the list.

An application's identifier is the one its authz.AppVocabulary declares and its entitlements and the orgs claim's apps map use, so registering an application is one step: roles and scopes in the vocabulary, how it is shown here. SystemAuth publishes the catalog at WellKnownPath; it is public, since names and launch URLs are not secret. Which entries a person sees is decided per organization by the orgs claim: an application they hold no role in is not shown.

Index

Constants

View Source
const DefaultCacheTTL = 5 * time.Minute

DefaultCacheTTL is how long Remote reuses a fetched catalog.

View Source
const WellKnownPath = "/.well-known/sf-apps"

WellKnownPath is where SystemAuth publishes the catalog.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	// ID is the application identifier, as its vocabulary declares it.
	ID string `json:"id"`
	// Name is what the switcher shows.
	Name string `json:"name"`
	// URL is where the application opens: an absolute https URL (http only
	// for a loopback host).
	URL string `json:"url"`
	// Icon is an optional icon URL or short icon name the shells know.
	Icon string `json:"icon,omitempty"`
	// Order places the application in the list, lowest first; ties are
	// ordered by name.
	Order int `json:"order,omitempty"`
}

App is one application in the catalog.

type Catalog

type Catalog struct {
	// contains filtered or unexported fields
}

Catalog is a validated, ordered set of applications.

func New

func New(apps ...App) (*Catalog, error)

New validates apps and returns their catalog. Identifiers must be unique short lower-case names (the vocabulary rule), names non-empty, and URLs absolute https (http only for a loopback host) without credentials.

func (*Catalog) Apps

func (c *Catalog) Apps() []App

Apps returns the applications in order. The slice is a copy.

func (*Catalog) Document

func (c *Catalog) Document() Document

Document returns the catalog as published.

func (*Catalog) Get

func (c *Catalog) Get(id string) (App, bool)

Get returns the application with id.

type Document

type Document struct {
	Apps []App `json:"apps"`
}

Document is the published catalog.

type Source

type Source interface {
	Apps(ctx context.Context) ([]App, error)
}

Source supplies the catalog to a relying party.

func Remote

func Remote(issuer string, client *http.Client, ttl time.Duration) Source

Remote fetches the catalog SystemAuth publishes at issuer + WellKnownPath and reuses it for ttl (DefaultCacheTTL when zero). A failed fetch returns the last catalog it fetched, if any, so a SystemAuth outage does not empty the switcher.

func Static

func Static(c *Catalog) Source

Static serves a catalog the host already has (an application embedded with SystemAuth in one process).

Jump to

Keyboard shortcuts

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