caclient

package
v0.0.0-...-1d35728 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultTokenProvider

func NewDefaultTokenProvider(opts *security.Options) credentials.PerRPCCredentials

Types

type DefaultTokenProvider

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

TokenProvider is a grpc PerRPCCredentials that can be used to attach a JWT token to each gRPC call. TokenProvider can be used for XDS, which may involve token exchange through STS.

func (*DefaultTokenProvider) GetRequestMetadata

func (t *DefaultTokenProvider) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

func (*DefaultTokenProvider) GetToken

func (t *DefaultTokenProvider) GetToken() (string, error)

GetToken fetches a token to attach to a request. Returning "", nil will cause no header to be added; while a non-nil error will block the request If the token selected is not found, no error will be returned, causing no authorization header to be set. This ensures that even if the JWT token is missing (for example, on a VM that has rebooted, causing the token to be removed from volatile memory), we can still proceed and allow other authentication methods to potentially handle the request, such as mTLS.

func (*DefaultTokenProvider) RequireTransportSecurity

func (t *DefaultTokenProvider) RequireTransportSecurity() bool

Allow the token provider to be used regardless of transport security; callers can determine whether this is safe themselves.

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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