auth

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthConfig

type AuthConfig struct {
	TokenURL     string `yaml:"token_url" json:"token_url"`
	ClientID     string `yaml:"client_id" json:"client_id"`
	ClientSecret string `yaml:"client_secret" json:"client_secret"`
	Scope        string `yaml:"scope" json:"scope"`
}

type Manager

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

Manager gerencia o ciclo de vida do token de forma thread-safe.

func NewManager

func NewManager(fetcher TokenFetcher) *Manager

NewManager cria um gerenciador genérico.

func NewOAuth2Manager

func NewOAuth2Manager(cfg AuthConfig) *Manager

NewOAuth2Manager é um helper que cria o Manager já configurado para Client Credentials.

func (*Manager) Get

func (m *Manager) Get() (string, error)

Get retorna o token atual de forma segura.

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start inicia o loop de renovação em background.

func (*Manager) Stop

func (m *Manager) Stop()

Stop encerra o processo de renovação.

type TokenFetcher

type TokenFetcher func(ctx context.Context) (string, time.Duration, error)

TokenFetcher define a função que sabe como buscar um novo token.

func NewOAuth2Fetcher

func NewOAuth2Fetcher(cfg AuthConfig) TokenFetcher

NewOAuth2Fetcher cria a função de busca específica para o fluxo Client Credentials.

Jump to

Keyboard shortcuts

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