auth

package
v1.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package auth obtains, stores and refreshes the user's own OIDC token for airavata-mcp.

Index

Constants

View Source
const (
	DefaultIssuer = "https://cilogon.org"
	EnvToken      = "AIRAVATA_MCP_TOKEN"
)

Variables

View Source
var DefaultScopes = []string{"openid", "email", "profile", "org.cilogon.userinfo", "offline_access"}
View Source
var ErrNotLoggedIn = errors.New("not logged in: run `airavata-mcp login`")

Functions

func Logout

func Logout(cfg Config) error

func NewTokenSource

func NewTokenSource(ctx context.Context, cfg Config) (TokenSource, *Principal, error)

func NormalizeSubject

func NormalizeSubject(sub string) string

Types

type Config

type Config struct {
	Issuer       string
	ClientID     string
	Scopes       []string
	APIURL       string
	HTTPClient   *http.Client
	Out          io.Writer
	OpenBrowser  func(url string) error
	LoginTimeout time.Duration
}

type Principal

type Principal struct {
	Subject    string
	RawSubject string
	Name       string
	Email      string
}

func Identify

func Identify(ctx context.Context, cfg Config, accessToken string) (*Principal, error)

func Login

func Login(ctx context.Context, cfg Config, device bool) (*Principal, error)

type TokenSource

type TokenSource interface {
	Token(ctx context.Context) (string, error)
}

Jump to

Keyboard shortcuts

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