client

package
v0.0.0-...-ae093c2 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Overview

Package client provides a client library for JVS

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JVSClient

type JVSClient struct {
	// contains filtered or unexported fields
}

JVSClient allows for getting JWK keys from the JVS and validating JWTs with those keys.

func NewJVSClient

func NewJVSClient(ctx context.Context, config *JVSConfig) (*JVSClient, error)

NewJVSClient returns a JVSClient with the cache initialized.

func (*JVSClient) ValidateJWT

func (j *JVSClient) ValidateJWT(jwtStr string) (jwt.Token, error)

ValidateJWT takes a jwt string, converts it to a JWT, and validates the signature against the keys in the JWKs endpoint.

type JVSConfig

type JVSConfig struct {
	// Version is the version of the config.
	Version string `yaml:"version,omitempty" env:"VERSION,overwrite,default=1"`

	// JWKSEndpoint is the full path (including protocol and port) to the JWKS
	// endpoint on a JVS server (e.g. https://jvs.corp:8080/.well-known/jwks).
	JWKSEndpoint string `yaml:"endpoint,omitempty" env:"ENDPOINT,overwrite"`

	// CacheTimeout is the duration that keys stay in cache before being revoked.
	CacheTimeout time.Duration `yaml:"cache_timeout" env:"CACHE_TIMEOUT,overwrite,default=5m"`

	// AllowBreakglass represents whether the jvs client allows breakglass.
	AllowBreakglass bool `yaml:"allow_breakglass" env:"ALLOW_BREAKGLASS,overwrite,default=false"`
}

JVSConfig is the jvs client configuration.

func LoadJVSConfig

func LoadJVSConfig(ctx context.Context, b []byte) (*JVSConfig, error)

LoadJVSConfig calls the necessary methods to load in config using the OsLookuper which finds env variables specified on the host.

func (*JVSConfig) Validate

func (cfg *JVSConfig) Validate() error

Validate checks if the config is valid.

Jump to

Keyboard shortcuts

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