formatter

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package formatter exposes printers and formatters for justifications and justification tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Formatter

type Formatter interface {
	// FormatTo streams the result to the writer.
	FormatTo(ctx context.Context, w io.Writer, token jwt.Token, breakglass bool) error
}

Formatter is an interface which all formatters must implement.

type JSON

type JSON struct{}

JSON outputs the JWT as a pretty-printed JSON blob.

func NewJSON

func NewJSON() *JSON

NewJSON creates a new text formatter.

func (*JSON) FormatTo

func (j *JSON) FormatTo(ctx context.Context, w io.Writer, token jwt.Token, breakglass bool) error

FormatTo renders the token to the given writer as json.

type Text

type Text struct{}

Text outputs the token into three sections:

  • breakglass
  • justification
  • standard claims

func NewText

func NewText() *Text

NewText creates a new text formatter.

func (*Text) FormatTo

func (t *Text) FormatTo(ctx context.Context, w io.Writer, token jwt.Token, breakglass bool) error

FormatTo renders the token to the given writer as a table.

type YAML

type YAML struct{}

YAML outputs the JWT as a pretty-printed YAML blob.

func NewYAML

func NewYAML() *YAML

NewYAML creates a new text formatter.

func (*YAML) FormatTo

func (y *YAML) FormatTo(ctx context.Context, w io.Writer, token jwt.Token, breakglass bool) error

FormatTo renders the token to the given writer as yaml.

Jump to

Keyboard shortcuts

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