kustomer

package module
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2021 License: AGPL-3.0-only Imports: 18 Imported by: 1

README

Kopano Customer Daemon

Customer service for Kopano customer related configuration and licensing.

Build dependencies

Make sure you have Go 1.13 or later installed. This project uses Go modules.

Building from source

git clone <THIS-PROJECT> kustomer
cd kustomer
make

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLicenseLeeway = 24 * time.Hour

DefaultLicenseLeeway is the default leeway when comparing timestamps in licenses.

Functions

This section is empty.

Types

type JWKSFetcher

type JWKSFetcher struct {
	URIs      []*url.URL
	UserAgent string

	Client *http.Client
	Logger logrus.FieldLogger

	MaxRetries int
	// contains filtered or unexported fields
}

A JWKSFetcher defines the parameters how to fetch a JWK set from URI.

func (*JWKSFetcher) ETag

func (jwksf *JWKSFetcher) ETag() string

func (*JWKSFetcher) JWKS

func (jwksf *JWKSFetcher) JWKS() *jose.JSONWebKeySet

func (*JWKSFetcher) Offline

func (jwksf *JWKSFetcher) Offline() bool

func (*JWKSFetcher) Update

func (jwksf *JWKSFetcher) Update(ctx context.Context) (*jose.JSONWebKeySet, error)

Update fetches the JWKS from its URI with retry.

type LicensesLoader

type LicensesLoader struct {
	// If CertPool is set, licenses are validated with it when offline.
	CertPool *x509.CertPool

	// JWKS is the key set for license validation when not offline.
	JWKS *jose.JSONWebKeySet

	// Offline allows license valdation with keys from CertPool if not found in JWKS.
	Offline bool

	// Logger is the logger used. If nil, a standard logger is used.
	Logger logrus.FieldLogger

	// History is a map to avoid loading the same license twice if not nil.
	LoadHistory     map[string]*license.Claims
	ActivateHistory map[string]*license.Claims

	// Hooks.
	OnActivate func(*license.Claims)
	OnRemove   func(*license.Claims)
	OnNew      func(*license.Claims)
	OnSkip     func(*license.Claims)
}

A LicensesLoader defines the parameters how to load licenses from a folder path.

func (*LicensesLoader) ScanFolder

func (ll *LicensesLoader) ScanFolder(licensesPath string, expected jwt.Expected) ([]*license.Claims, error)

ScanFolder scans the provided folder for license files, loads, parses and validates them all and returns the claim set for each currently valid license.

func (*LicensesLoader) UnsafeScanFolderWithoutVerification

func (ll *LicensesLoader) UnsafeScanFolderWithoutVerification(licensesPath string, expected jwt.Expected) ([]*license.Claims, error)

UnsafeScanFolderWithoutVerification scans the provided folder for license files, loads parses and skips validation if no matching key is found, making this function unsafe to use when its required to only return valid license claim sets.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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