auth

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: GPL-3.0 Imports: 11 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

View Source
const AzureCLIClientID = "04b07795-8ddb-461a-bbee-02f9e1bf7b46"

AzureCLIClientID is the well-known public client ID used by Azure CLI. No app registration required — works across all tenants without admin consent.

Variables

This section is empty.

Functions

This section is empty.

Types

type MicrosoftDeviceFlow

type MicrosoftDeviceFlow struct {
	DeviceCode      string
	UserCode        string
	VerificationURI string
	ExpiresAt       time.Time
	Interval        int
	// contains filtered or unexported fields
}

MicrosoftDeviceFlow holds state for an in-progress device code flow.

func NewMicrosoftDeviceFlow

func NewMicrosoftDeviceFlow(baseURL, tenant string) (*MicrosoftDeviceFlow, error)

NewMicrosoftDeviceFlow initiates a device code flow against the given base URL and tenant. For production use: baseURL="https://login.microsoftonline.com", tenant="consumers".

func (*MicrosoftDeviceFlow) Poll

func (f *MicrosoftDeviceFlow) Poll(ctx context.Context) (*Token, error)

Poll waits for the user to complete the device code flow, polling the token endpoint at the specified interval. Blocks until a token is received, the flow expires, or ctx is cancelled.

type Token

type Token struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token"`
	ExpiresAt    time.Time `json:"expires_at"`
}

Token holds an OAuth access token and its metadata.

type TokenStore

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

TokenStore encrypts and stores OAuth tokens in SQLite using AES-256-GCM.

func NewTokenStore

func NewTokenStore(store *db.Store, key []byte) *TokenStore

NewTokenStore creates a TokenStore backed by store, encrypting with key. key must be exactly 32 bytes for AES-256.

func (*TokenStore) Load

func (ts *TokenStore) Load(sourceID int64, provider string) (*Token, error)

Load retrieves and decrypts the token for the given sourceID and provider. Returns an error (wrapping db.ErrNotFound via sql.ErrNoRows) if not found.

func (*TokenStore) Save

func (ts *TokenStore) Save(sourceID int64, provider string, token *Token) error

Save encrypts token and persists it for the given sourceID and provider.

Jump to

Keyboard shortcuts

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