auth

package
v0.37.0 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MPL-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package auth provides shared authentication logic for Tharsis CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator added in v0.31.0

type Authenticator interface {
	Authenticate(ctx context.Context) (*oauth2.Token, error)
	StoreToken(token *oauth2.Token) error
}

Authenticator handles authentication flow.

func NewSSOAuthenticator added in v0.31.0

func NewSSOAuthenticator(tharsisURL string, opts ...Option) (Authenticator, error)

NewSSOAuthenticator creates a new SSO authenticator.

type MockAuthenticator added in v0.31.0

type MockAuthenticator struct {
	mock.Mock
}

MockAuthenticator is an autogenerated mock type for the Authenticator type

func NewMockAuthenticator added in v0.31.0

func NewMockAuthenticator(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockAuthenticator

NewMockAuthenticator creates a new instance of MockAuthenticator. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockAuthenticator) Authenticate added in v0.31.0

func (_m *MockAuthenticator) Authenticate(ctx context.Context) (*oauth2.Token, error)

Authenticate provides a mock function with given fields: ctx

func (*MockAuthenticator) StoreToken added in v0.31.0

func (_m *MockAuthenticator) StoreToken(token *oauth2.Token) error

StoreToken provides a mock function with given fields: token

type Option added in v0.31.0

type Option func(*Options)

Option is a functional option for authenticator options.

func WithGRPCClient added in v0.31.0

func WithGRPCClient(grpcClient *client.GRPCClient) Option

WithGRPCClient sets the gRPC client.

func WithLogger

func WithLogger(l hclog.Logger) Option

WithLogger sets the logger.

func WithUI

func WithUI(u terminal.UI) Option

WithUI sets the UI for output.

type Options added in v0.31.0

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

Options contains optional fields for creating an authenticator.

Jump to

Keyboard shortcuts

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