auth

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package auth provides shared authentication logic for Phobos CLI.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authenticator

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

Authenticator handles authentication flow.

func NewSSOAuthenticator

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

NewSSOAuthenticator creates a new SSO authenticator.

type MockAuthenticator

type MockAuthenticator struct {
	mock.Mock
}

MockAuthenticator is an autogenerated mock type for the Authenticator type

func NewMockAuthenticator

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

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

Authenticate provides a mock function with given fields: ctx

func (*MockAuthenticator) StoreToken

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

StoreToken provides a mock function with given fields: token

type Option

type Option func(*Options)

Option is a functional option for authenticator options.

func WithGRPCClient

func WithGRPCClient(grpcClient *client.Client) 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

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
⌂ 换网址