auth

package
v0.0.8 Latest Latest
Warning

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

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

Documentation

Overview

Package auth provides an auto managed token client, capable of monitoring token expiration and refresh access token automatically without any intervention of the user.

It defines a type, Handler, wich provides several methods (such as Handler.GetToken, Handler.Start and Handler.Stop) to enable the interaction with the token client.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler added in v0.0.8

type Handler interface {
	GetToken() (string, error)
	Start() error
	Stop()
	// contains filtered or unexported methods
}

func New added in v0.0.8

func New(apiURL string, req TokenRequest, insecureSkipVerify bool, accessToken *string) Handler

type ManagedToken

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

ManagedToken gerencia o ciclo de vida do token STS

func (*ManagedToken) GetToken

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

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

func (*ManagedToken) Start

func (tm *ManagedToken) 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 (*ManagedToken) Stop

func (tm *ManagedToken) Stop()

Stop interrompe o gerenciador de token

type TokenRequest added in v0.0.8

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

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

Jump to

Keyboard shortcuts

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