cmd

package
v0.0.0-...-d95e9ea Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddExchange

func AddExchange(parent *cobra.Command)

func AddLogin

func AddLogin(parent *cobra.Command)

func AddLogout

func AddLogout(parent *cobra.Command)

func AddToken

func AddToken(parent *cobra.Command)

func AddVerify

func AddVerify(parent *cobra.Command)

func AddWhoami

func AddWhoami(parent *cobra.Command)

Types

type ExchangeOptions

type ExchangeOptions struct {
	TokenReadOptions
	ServerOptions
	Audience []string
	Scope    []string
	Resource []string
	Cache    bool // Enable token caching
}

ExchangeOptions are the options to perform a token exchange

func (*ExchangeOptions) AddFlags

func (eo *ExchangeOptions) AddFlags(cmd *cobra.Command)

func (*ExchangeOptions) Config

func (*ExchangeOptions) Validate

func (eo *ExchangeOptions) Validate() error

type JWK

type JWK struct {
	Kty string `json:"kty"` // Key type
	Kid string `json:"kid"` // Key ID
	Use string `json:"use"` // Public key use
	Alg string `json:"alg"` // Algorithm
	// RSA fields
	N string `json:"n"` // RSA modulus
	E string `json:"e"` // RSA exponent
	// EC fields
	Crv string `json:"crv"` // EC curve
	X   string `json:"x"`   // EC X coordinate
	Y   string `json:"y"`   // EC Y coordinate
}

JWK represents a JSON Web Key

type JWKS

type JWKS struct {
	Keys []JWK `json:"keys"`
}

JWKS represents a JSON Web Key Set

type LoginOptions

type LoginOptions struct {
	ServerOptions
	LoginURL   string
	PrintToken bool
	Force      bool
}

func (*LoginOptions) AddFlags

func (lo *LoginOptions) AddFlags(cmd *cobra.Command)

func (*LoginOptions) Config

func (lo *LoginOptions) Config() *command.OptionsSetConfig

func (*LoginOptions) Validate

func (lo *LoginOptions) Validate() error

Validate the options set

type LogoutOptions

type LogoutOptions struct {
	ServerOptions
	All bool
}

func (*LogoutOptions) AddFlags

func (lo *LogoutOptions) AddFlags(cmd *cobra.Command)

func (*LogoutOptions) Config

func (lo *LogoutOptions) Config() *command.OptionsSetConfig

func (*LogoutOptions) Validate

func (lo *LogoutOptions) Validate() error

type ServerOptions

type ServerOptions struct {
	Server string
}

func (*ServerOptions) AddFlags

func (so *ServerOptions) AddFlags(cmd *cobra.Command)

func (*ServerOptions) Config

func (eo *ServerOptions) Config() *command.OptionsSetConfig

func (*ServerOptions) Validate

func (so *ServerOptions) Validate() error

type TokenClaims

type TokenClaims struct {
	Subject   string   `json:"sub,omitempty"`
	Email     string   `json:"email,omitempty"`
	Name      string   `json:"name,omitempty"`
	Issuer    string   `json:"iss,omitempty"`
	Audience  []string `json:"aud,omitempty"`
	ExpiresAt int64    `json:"exp,omitempty"`
	IssuedAt  int64    `json:"iat,omitempty"`
	Provider  string   `json:"provider,omitempty"`
}

TokenClaims represents the claims we extract from the Carabiner token

type TokenOptions

type TokenOptions struct {
	ServerOptions
	Decode  bool
	Service string // Audience of a cached service token to display
}

func (*TokenOptions) AddFlags

func (to *TokenOptions) AddFlags(cmd *cobra.Command)

func (*TokenOptions) Config

func (to *TokenOptions) Config() *command.OptionsSetConfig

func (*TokenOptions) Validate

func (to *TokenOptions) Validate() error

type TokenReadOptions

type TokenReadOptions struct {
	TokenPath string
}

TokenReadOptions are the options to read a token from various sources

func (*TokenReadOptions) AddFlags

func (to *TokenReadOptions) AddFlags(cmd *cobra.Command)

func (*TokenReadOptions) Config

func (*TokenReadOptions) ReadToken

func (to *TokenReadOptions) ReadToken() (string, error)

ReadToken reads a token with the following precedence: 1. stdin (if "-" is specified or data is piped) 2. --token flag (explicit file path) 3. carabiner identity file (~/.config/carabiner/identity.json)

Note: This uses context.Background() for auto-renewal. Use ReadTokenWithContext for better context control.

func (*TokenReadOptions) ReadTokenWithContext

func (to *TokenReadOptions) ReadTokenWithContext(ctx context.Context) (string, error)

ReadTokenWithContext reads a token with the following precedence: 1. stdin (if "-" is specified or data is piped) 2. --token flag (explicit file path) 3. carabiner identity file (with auto-renewal if about to expire)

func (*TokenReadOptions) Validate

func (to *TokenReadOptions) Validate() error

type VerifyOptions

type VerifyOptions struct {
	TokenReadOptions
	ExpectedIssuer string
	SkipExpiry     bool
	SkipSignature  bool
}

func (*VerifyOptions) AddFlags

func (vo *VerifyOptions) AddFlags(cmd *cobra.Command)

func (*VerifyOptions) Config

func (vo *VerifyOptions) Config() *command.OptionsSetConfig

func (*VerifyOptions) Validate

func (vo *VerifyOptions) Validate() error

type WhoamiOptions

type WhoamiOptions struct {
	ServerOptions
	JSON bool
}

func (*WhoamiOptions) AddFlags

func (wo *WhoamiOptions) AddFlags(cmd *cobra.Command)

func (*WhoamiOptions) Config

func (wo *WhoamiOptions) Config() *command.OptionsSetConfig

func (*WhoamiOptions) Validate

func (wo *WhoamiOptions) Validate() error

Jump to

Keyboard shortcuts

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