common

package
v0.1.35 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package common holds helpers shared across oneauth examples — the seam where "every example needs this now" updates land in one place instead of N copy-paste edits.

Each example follows the same shape:

main.go         — boots the auth server and resource server. With
                  --serve, binds them on real ports and blocks so any
                  external client can drive them. Default behavior
                  spins them up in-process and runs the walkthrough.
walkthrough.go  — defines the demokit demo (the "client") that drives
                  the servers and prints the protocol exchange.

SetupRenderer wires the TUI renderer when --tui is passed; the default PlainRenderer stays in place otherwise. Examples should call this before demo.Execute().

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOneAuthLogger

func NewOneAuthLogger(prefix string, extraRules ...demokit.ColorRule) *log.Logger

NewOneAuthLogger returns the canonical demokit ColorLogger used across oneauth examples. The baseline rules tint:

  • error= and ERROR markers (red)
  • [http] → outbound HTTP requests (gray / dim blue)
  • [http] ← inbound HTTP responses (cyan / blue)
  • "minted" / "issued" token-mint events (bright green / green)

extraRules append to the baseline so callers can tint example-specific lines without losing the shared set.

func SetupRenderer

func SetupRenderer(demo *demokit.Demo)

SetupRenderer wires the renderer matching demokit's --mode (or the legacy --tui alias):

--mode=tui      → tui.New()              (Lipgloss boxes)
--mode=notebook → notebookbridge.New()   (cell-based UI)
default         → demokit's PlainRenderer

Types

This section is empty.

Jump to

Keyboard shortcuts

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