Help us shape the future of Go! Take the 2026 Go Developer Survey

auth

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ApiKeyMethod mints a token from an API key id and secret.
	ApiKeyMethod = credential.ApiKeyName
	// ManualMethod sends an access token as it is.
	ManualMethod = credential.ManualName
	// OidcLoginMethod logs a person in through a browser, so it resolves only when asked for by name.
	OidcLoginMethod = credential.OidcLoginName
)

Variables

This section is empty.

Functions

func ResolveClient

func ResolveClient(ctx context.Context, opts ResolveSessionOptions) (client.Client, error)

ResolveClient resolves a session and builds its client in one call.

Types

type Method

type Method = credential.Name

Method names one way of authenticating, as [ResolveSessionOptions.ForceAuthWith] takes it.

func MethodFromContext

func MethodFromContext(ctx context.Context) (Method, error)

MethodFromContext returns how this session authenticates. The method is only in the context while MESHSTACK_WORKSPACE is being resolved, so a lookup for any other setting gets an error.

type ResolveSessionOptions

type ResolveSessionOptions = auth.ResolveSessionOptions

ResolveSessionOptions carries the setting sources, the calling front end and the credential to insist on.

type Session

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

Session is one resolved profile and credential, and builds an authorized client from them.

func ResolveSession

func ResolveSession(ctx context.Context, opts ResolveSessionOptions) (result Session, err error)

ResolveSession resolves the profile, creating a default one when none exists. It checks no backend version, so prefer ResolveClient where the Session itself is not needed.

func (Session) Client

func (s Session) Client() (client.Client, error)

Client builds the authorized client and checks the backend version, unless MESHSTACK_SKIP_VERSION_CHECK asks it not to. It is built once, from the context ResolveSession was given, so it takes none of its own.

func (Session) Status

func (s Session) Status(ctx context.Context) (status Status, err error)

Status reads the backend's info and mints a bearer token, so that an unusable credential fails here. A Session.Store afterwards persists that token.

func (Session) Store

func (s Session) Store(ctx context.Context) error

Store writes the resolved session, its credentials and its cached tokens into the current profile.

type Status

type Status struct {
	client.MeshInfo

	Endpoint xurl.URL
}

Status is what the meshStack backend reports about itself, and the endpoint it was asked at.

Jump to

Keyboard shortcuts

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