Documentation
¶
Index ¶
- func NewHTTPClient(ctx context.Context, opts ...Opt) *http.Client
- func NewTokenSource(opts ...Opt) oauth2.TokenSource
- func NewUnixSocketClient(path string) *http.Client
- type Claims
- type CustomClaims
- type Opt
- type PrincipalSource
- func (s *PrincipalSource) Claims(ctx context.Context) map[string]any
- func (s *PrincipalSource) Extract(ctx context.Context, _ *http.Request) (string, error)
- func (s *PrincipalSource) IsService(ctx context.Context) bool
- func (s *PrincipalSource) Name() string
- func (s *PrincipalSource) Roles(ctx context.Context) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTokenSource ¶
func NewTokenSource(opts ...Opt) oauth2.TokenSource
NewTokenSource: https://fly.io/docs/security/openid-connect/
func NewUnixSocketClient ¶
Types ¶
type Claims ¶
type Claims struct {
jwtvalidator.RegisteredClaims
CustomClaims
}
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 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) 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
Click to show internal directories.
Click to hide internal directories.