auth

package
v0.0.0-...-abe4fc6 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotLoggedIn = fmt.Errorf("not logged in")

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(
	issuer, clientID string,
	scopes []string,
	successRedirect string,
	audience []string,
) (*Client, error)

func (*Client) AddSession

func (c *Client) AddSession(tok *session.Token) error

func (*Client) GetSession

func (c *Client) GetSession(ctx context.Context) (*session.Token, error)

GetSession returns the current valid session token, if any. If token is expired, it will attempt to refresh it. If no token is found, or is unable to be refreshed, it will return error.

func (*Client) GetSessions

func (c *Client) GetSessions() ([]refreshableTokenSource, error)

GetSessions returns all session tokens as refreshableTokenSource. This means that they may not be valid or even refreshable. Callers can use Token() to refresh the token if needed. Even if Token() fails to refresh, it still returns the token, so callers can use the expired data if they want. This allows callers to list all sessions, even if they are expired. Callers can use Peek() to inspect token data without refreshing.

func (*Client) LoginFlow

func (c *Client) LoginFlow() (*session.Token, error)

func (*Client) LoginFlowIfNeeded

func (c *Client) LoginFlowIfNeeded(ctx context.Context) (*session.Token, error)

func (*Client) LoginFlowIfNeededForOrg

func (c *Client) LoginFlowIfNeededForOrg(
	ctx context.Context,
	orgID string,
) (*session.Token, error)

LoginFlowIfNeededForOrg returns the current valid session token for a given org and prompts to log in if needed. Note: I'm not sure this is best API. Currently evolving

func (*Client) LogoutFlow

func (c *Client) LogoutFlow() error

func (*Client) RevokeSession

func (c *Client) RevokeSession() error

Directories

Path Synopsis
cmd
auth command
internal

Jump to

Keyboard shortcuts

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