flyio

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 6, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(ctx context.Context, opts ...Opt) *http.Client

func NewTokenSource

func NewTokenSource(opts ...Opt) oauth2.TokenSource

NewTokenSource: https://fly.io/docs/security/openid-connect/

func NewUnixSocketClient

func NewUnixSocketClient(path string) *http.Client

Types

type Claims

type Claims struct {
	jwtvalidator.RegisteredClaims
	CustomClaims
}

func (*Claims) Validate

func (c *Claims) Validate(_ context.Context) error

type CustomClaims

type CustomClaims struct {
	// Fly.io specific claims
	AppId          string `json:"app_id"`
	AppName        string `json:"app_name"`
	Image          string `json:"image"`
	ImageDigest    string `json:"image_digest"`
	MachineId      string `json:"machine_id"`
	MachineName    string `json:"machine_name"`
	MachineVersion string `json:"machine_version"`
	OrgId          string `json:"org_id"`
	OrgName        string `json:"org_name"`
	Region         string `json:"region"`
}

CustomClaims represents the custom claims in a Fly.io OIDC token

type Opt

type Opt func(*tokenSource)

func WithAudience

func WithAudience(aud string) Opt

type PrincipalSource added in v0.4.0

type PrincipalSource struct {
	// RoleMapper maps raw Fly.io JWT claims to internal role strings.
	// When nil, Roles returns nil.
	RoleMapper mapper.Mapper
}

PrincipalSource extracts principal identity from Fly.io OIDC tokens.

func (*PrincipalSource) Claims added in v0.4.0

func (s *PrincipalSource) Claims(ctx context.Context) map[string]any

Claims returns the Fly.io token claims as a map. Canonical attribute keys (e.g. "username") are included alongside raw Fly.io claim names so that ClaimRoleMapper rules can reference either form.

func (*PrincipalSource) Extract added in v0.4.0

func (s *PrincipalSource) Extract(ctx context.Context, _ *http.Request) (string, error)

func (*PrincipalSource) IsService added in v0.4.0

func (s *PrincipalSource) IsService(ctx context.Context) bool

IsService returns true for any valid Fly.io token, as these represent machine identities.

func (*PrincipalSource) Name added in v0.4.0

func (s *PrincipalSource) Name() string

func (*PrincipalSource) Roles added in v0.4.0

func (s *PrincipalSource) Roles(ctx context.Context) []string

Roles returns the internal roles derived from Fly.io claims via the configured RoleMapper. Returns nil when no mapper is set.

Jump to

Keyboard shortcuts

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