Documentation
¶
Index ¶
- func AddExchange(parent *cobra.Command)
- func AddLogin(parent *cobra.Command)
- func AddLogout(parent *cobra.Command)
- func AddToken(parent *cobra.Command)
- func AddVerify(parent *cobra.Command)
- func AddWhoami(parent *cobra.Command)
- type ExchangeOptions
- type JWK
- type JWKS
- type LoginOptions
- type LogoutOptions
- type ServerOptions
- type TokenClaims
- type TokenOptions
- type TokenReadOptions
- func (to *TokenReadOptions) AddFlags(cmd *cobra.Command)
- func (to *TokenReadOptions) Config() *command.OptionsSetConfig
- func (to *TokenReadOptions) ReadToken() (string, error)
- func (to *TokenReadOptions) ReadTokenWithContext(ctx context.Context) (string, error)
- func (to *TokenReadOptions) Validate() error
- type VerifyOptions
- type WhoamiOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddExchange ¶
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 (eo *ExchangeOptions) Config() *command.OptionsSetConfig
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 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
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 (to *TokenReadOptions) Config() *command.OptionsSetConfig
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