auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

internal/auth/bitbucket.go

internal/auth/credentials.go

internal/auth/github.go

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCredentials = errors.New("no credentials found")

Functions

func DefaultStorePath

func DefaultStorePath() string

Types

type BitbucketOAuth

type BitbucketOAuth struct {
	ClientID     string
	ClientSecret string
	TokenURL     string // overridable for testing
}

func (*BitbucketOAuth) ExchangeCode

func (b *BitbucketOAuth) ExchangeCode(ctx context.Context, code string) (Credentials, error)

func (*BitbucketOAuth) Login

func (b *BitbucketOAuth) Login(ctx context.Context) (Credentials, error)

func (*BitbucketOAuth) RefreshToken

func (b *BitbucketOAuth) RefreshToken(ctx context.Context, refreshToken string) (Credentials, error)

type Credentials

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

func (Credentials) Expired

func (c Credentials) Expired() bool

type FileStore

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

func NewFileStore

func NewFileStore(path string) *FileStore

func (*FileStore) Load

func (s *FileStore) Load(provider string) (Credentials, error)

func (*FileStore) LoadWithEnv

func (s *FileStore) LoadWithEnv(provider string) (Credentials, error)

func (*FileStore) Save

func (s *FileStore) Save(provider string, cred Credentials) error

type GitHubOAuth

type GitHubOAuth struct {
	ClientID    string
	DeviceURL   string // overridable for testing
	TokenURL    string // overridable for testing
	OpenBrowser bool
}

func (*GitHubOAuth) Login

func (g *GitHubOAuth) Login(ctx context.Context) (Credentials, error)

Jump to

Keyboard shortcuts

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