bearer

package
v1.48.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type StaticTokenProvider

type StaticTokenProvider struct {
	Token Token
}

StaticTokenProvider provides a utility for wrapping a static bearer token value within an implementation of a token provider.

func (StaticTokenProvider) RetrieveBearerToken

func (s StaticTokenProvider) RetrieveBearerToken(aws.Context) (Token, error)

RetrieveBearerToken returns the static token specified.

type Token

type Token struct {
	Value string

	CanExpire bool
	Expires   time.Time
}

Token provides a type wrapping a bearer token and expiration metadata.

func (Token) Expired

func (t Token) Expired(now time.Time) bool

Expired returns if the token's Expires time is before or equal to the time provided. If CanExpire is false, Expired will always return false.

type TokenProvider

type TokenProvider interface {
	RetrieveBearerToken(aws.Context) (Token, error)
}

TokenProvider provides interface for retrieving bearer tokens.

type TokenProviderFunc

type TokenProviderFunc func(aws.Context) (Token, error)

TokenProviderFunc provides a helper utility to wrap a function as a type that implements the TokenProvider interface.

func (TokenProviderFunc) RetrieveBearerToken

func (fn TokenProviderFunc) RetrieveBearerToken(ctx aws.Context) (Token, error)

RetrieveBearerToken calls the wrapped function, returning the Token or error.

Jump to

Keyboard shortcuts

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