token

package
v1.12.42 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	Token      *zts.AccessTokenResponse
	ExpiryTime int64
	Duration   time.Duration
}

func (*AccessToken) GetDuration

func (at *AccessToken) GetDuration() time.Duration

func (*AccessToken) GetExpiryTime

func (at *AccessToken) GetExpiryTime() int64

func (*AccessToken) GetToken

func (at *AccessToken) GetToken() *zts.AccessTokenResponse

type AccessTokenClient

type AccessTokenClient struct {
	*BaseTokenClient[*AccessToken]
}

func NewAccessTokenClient

func NewAccessTokenClient(ctx context.Context, ztsUrl, pem, key string) (*AccessTokenClient, context.CancelFunc)

func NewAccessTokenClientSetCacheUpdateDuration

func NewAccessTokenClientSetCacheUpdateDuration(ctx context.Context, ztsUrl, pem, key string, cacheRefreshDuration time.Duration) (*AccessTokenClient, context.CancelFunc)

type BaseTokenClient

type BaseTokenClient[T Token] struct {
	*Client
	// contains filtered or unexported fields
}

func (*BaseTokenClient[T]) GetToken

func (btc *BaseTokenClient[T]) GetToken(domain string, roles []string) (T, error)

func (*BaseTokenClient[T]) GetTokenWithExpire

func (btc *BaseTokenClient[T]) GetTokenWithExpire(domain string, roles []string, exp int32) (T, error)

type Client

type Client struct {
	ZTS   ZTSClientInterface
	Cache *cache.Cache
	Tok   GetToken
}

func NewClient

func NewClient(url, pem, key string) *Client

func (*Client) SetProxy

func (c *Client) SetProxy(proxyURL string)

func (*Client) SetTLSConfig

func (c *Client) SetTLSConfig(tlsConfig *tls.Config)

func (*Client) Transport

func (c *Client) Transport() *http.Transport

func (*Client) UpdateCachePeriodically

func (c *Client) UpdateCachePeriodically(ctx context.Context, tk GetToken, interval time.Duration)

func (*Client) WatchCertificateFiles

func (c *Client) WatchCertificateFiles(ctx context.Context, certFile, keyFile string) error

type GetToken

type GetToken interface {
	// contains filtered or unexported methods
}

type RoleToken

type RoleToken struct {
	Token      *zts.RoleToken
	ExpiryTime int64
	Duration   time.Duration
}

func (*RoleToken) GetDuration

func (rt *RoleToken) GetDuration() time.Duration

func (*RoleToken) GetExpiryTime

func (rt *RoleToken) GetExpiryTime() int64

func (*RoleToken) GetToken

func (rt *RoleToken) GetToken() *zts.RoleToken

type RoleTokenClient

type RoleTokenClient struct {
	*BaseTokenClient[*RoleToken]
}

func NewRoleTokenClient

func NewRoleTokenClient(ctx context.Context, ztsUrl, pem, key string) (*RoleTokenClient, context.CancelFunc)

func NewRoleTokenClientSetCacheUpdateDuration

func NewRoleTokenClientSetCacheUpdateDuration(ctx context.Context, ztsUrl, pem, key string, cacheRefreshDuration time.Duration) (*RoleTokenClient, context.CancelFunc)

type Token

type Token interface {
	GetExpiryTime() int64
	GetDuration() time.Duration
}

type TokenGetterFunc

type TokenGetterFunc[T Token] func(domain string, roles string, exp int32) (T, error)

type ZTSClientInterface

type ZTSClientInterface interface {
	PostAccessTokenRequest(req zts.AccessTokenRequest) (*zts.AccessTokenResponse, error)
	GetRoleToken(domain zts.DomainName, roles zts.EntityList, minExpiryTime *int32, maxExpiryTime *int32, proxyForPrincipal zts.EntityName) (*zts.RoleToken, error)
	SetTransport(transport *http.Transport)
	Transport() *http.Transport
	URL() string
	SetURL(url string)
}

Jump to

Keyboard shortcuts

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