config

package
v1.2.37-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisallowedSetConfigProperties = []string{"scopes"}

Functions

func ConfigPropertiesNamesAndDocs added in v1.2.37

func ConfigPropertiesNamesAndDocs() ([]string, []string)

func ConfigVarDocs added in v1.2.37

func ConfigVarDocs() []string

func GetAllConfigProperties added in v1.2.37

func GetAllConfigProperties() []string

func GetAllowedConfigProperties added in v1.2.37

func GetAllowedConfigProperties() []string

func IsEncryptedToken

func IsEncryptedToken(textToken string) bool

func Location

func Location() (path string, err error)

Location returns the location of the configuration file. If a configuration file already exists in the HOME directory, it uses that, otherwise it prefers to use the XDG config directory.

func ParseToken

func ParseToken(textToken string) (token *jwt.Token, err error)

func Remove

func Remove() error

Remove removes the configuration file.

func Save

func Save(cfg *Config) error

Save saves the given configuration to the configuration file.

Types

type Config

type Config struct {
	AccessToken  string   `json:"access_token,omitempty" doc:"Bearer access token."`
	ClientID     string   `json:"client_id,omitempty" doc:"OpenID client identifier."`
	ClientSecret string   `json:"client_secret,omitempty" doc:"OpenID client secret."`
	Insecure     bool     `json:"insecure,omitempty" doc:"Enables insecure communication with the server."`
	RefreshToken string   `json:"refresh_token,omitempty" doc:"Offline or refresh token."`
	Scopes       []string `json:"scopes,omitempty" doc:"OpenID scope."`
	TokenURL     string   `json:"token_url,omitempty" doc:"OpenID token URL."`
	URL          string   `json:"url,omitempty" doc:"URL of the API gateway."`
	FedRAMP      bool     `json:"fedramp,omitempty" doc:"Indicates FedRAMP."`
}

Config is the type used to store the configuration of the client.

func Load

func Load() (cfg *Config, err error)

Load loads the configuration from the configuration file. If the configuration file doesn't exist it will return an empty configuration object.

func (*Config) Armed

func (c *Config) Armed() (armed bool, err error)

Armed checks if the configuration contains either credentials or tokens that haven't expired, so that it can be used to perform authenticated requests.

func (*Config) Connection

func (c *Config) Connection() (connection *sdk.Connection, err error)

Connection creates a connection using this configuration.

func (*Config) GetData

func (c *Config) GetData(key string) (value string, err error)

type JWETokenHeader

type JWETokenHeader struct {
	Algorithm   string `json:"alg"`
	Encryption  string `json:"enc"`
	ContentType string `json:"cty,omitempty"`
}

Jump to

Keyboard shortcuts

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