Help us shape the future of Go! Take the 2026 Go Developer Survey

auth

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoTrialLicense       = errors.New("no trial license found")
	ErrTrialExpired         = errors.New("trial license has expired")
	ErrLicenseWrongFilename = errors.New("source file is not named columnar.lic (use --force to override)")
	ErrLicenseAlreadyExists = errors.New("license already exists (use --force to overwrite)")
)

Functions

func AddCredential

func AddCredential(cred Credential, allowOverwrite bool) error

func DefaultOauthClientID

func DefaultOauthClientID() string

func DefaultOauthURI

func DefaultOauthURI() string

func FetchColumnarLicense

func FetchColumnarLicense(ctx context.Context, cred *Credential) error

func GetCredPathForTesting

func GetCredPathForTesting() string

func InstallLicenseFromFile added in v0.3.0

func InstallLicenseFromFile(srcPath string, force bool) error

func IsColumnarPrivateRegistry

func IsColumnarPrivateRegistry(u *url.URL) bool

func LicensePath added in v0.3.0

func LicensePath() (string, error)

func LoadCredentials

func LoadCredentials() error

func PurgeCredentials

func PurgeCredentials() error

func RemoveCredential

func RemoveCredential(host Uri) error

func ResetCredentialsForTesting

func ResetCredentialsForTesting()

func SetCredPathForTesting

func SetCredPathForTesting(path string) (restore func())

func UpdateCreds

func UpdateCreds() error

Types

type Credential

type Credential struct {
	Type         Type   `toml:"type"`
	AuthURI      Uri    `toml:"auth_uri"`
	RegistryURL  Uri    `toml:"registry_url"`
	ApiKey       string `toml:"api_key,omitempty"`
	Token        string `toml:"token"`
	RefreshToken string `toml:"refresh_token,omitempty"`
	ClientID     string `toml:"client_id,omitempty"`
	Audience     string `toml:"audience,omitempty"`
}

func GetCredentials

func GetCredentials(u *url.URL) (*Credential, error)

func (*Credential) GetAuthToken

func (t *Credential) GetAuthToken(ctx context.Context) string

GetAuthToken returns the current token, refreshing if needed. Must not be called while credMu is held (Refresh may acquire it via UpdateCreds).

func (*Credential) Refresh

func (t *Credential) Refresh(ctx context.Context) error

type OpenIDConfig

type OpenIDConfig struct {
	Issuer                            Uri      `json:"issuer"`
	AuthorizationEndpoint             Uri      `json:"authorization_endpoint"`
	TokenEndpoint                     Uri      `json:"token_endpoint"`
	DeviceAuthorizationEndpoint       Uri      `json:"device_authorization_endpoint"`
	UserinfoEndpoint                  Uri      `json:"userinfo_endpoint"`
	JwksURI                           Uri      `json:"jwks_uri"`
	ScopesSupported                   []string `json:"scopes_supported"`
	ResponseTypesSupported            []string `json:"response_types_supported"`
	SubjectTypesSupported             []string `json:"subject_types_supported"`
	IDTokenSigningAlgValuesSupported  []string `json:"id_token_signing_alg_values_supported"`
	ClaimsSupported                   []string `json:"claims_supported"`
	TokenEndpointAuthMethodsSupported []string `json:"token_endpoint_auth_methods_supported"`
	EndSessionEndpoint                Uri      `json:"end_session_endpoint"`
	RequestURIParameterSupported      bool     `json:"request_uri_parameter_supported"`
	RequestParameterSupported         bool     `json:"request_parameter_supported"`
}

func GetOpenIDConfig

func GetOpenIDConfig(ctx context.Context, issuer *url.URL) (config OpenIDConfig, err error)

type Type

type Type string
const (
	TypeApiKey Type = "apikey"
	TypeToken  Type = "oauth"
)

func (*Type) UnmarshalText

func (a *Type) UnmarshalText(text []byte) error

type Uri

type Uri url.URL

func (*Uri) MarshalText

func (u *Uri) MarshalText() ([]byte, error)

func (*Uri) String

func (u *Uri) String() string

func (*Uri) UnmarshalText

func (u *Uri) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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