auth

package
v0.1.14 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2025 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
}

AuthRequest representa os dados enviados para a API de autenticação

type TokenManager

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

TokenManager gerencia o ciclo de vida do token STS

func NewManagedToken

func NewManagedToken(apiURL string, authRequest AuthRequest, certSkipVerify bool) *TokenManager

func (*TokenManager) GetToken

func (tm *TokenManager) GetToken() (string, error)

GetToken retorna o token atual, garantindo que seja válido

func (*TokenManager) RefreshLoop

func (tm *TokenManager) RefreshLoop()

refreshLoop executa em background para manter o token atualizado

func (*TokenManager) RefreshToken

func (tm *TokenManager) RefreshToken() error

refreshToken faz uma chamada à API para obter um novo token

func (*TokenManager) Start

func (tm *TokenManager) Start() error

Start inicio o gerenciador de token e faz a primeira requisição para obter o token Retorna erro se não conseguir obter o token inicial

func (*TokenManager) Stop

func (tm *TokenManager) Stop()

Stop interrompe o gerenciador de token

type TokenResponse

type TokenResponse struct {
	Token        string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresAt    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	Active       bool   `json:"active"`
}

TokenResponse representa a resposta da API de autenticação

Jump to

Keyboard shortcuts

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