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 (*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.