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

authutil

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ActiveUserKey = "active_user"
View Source
const KnownUsersKey = "known_users"
View Source
const ServiceName = "datum-mcp-auth"

Variables

View Source
var ErrNoActiveUser = errors.New("no active user set. Please login first")

Functions

func DeriveAPIHostname

func DeriveAPIHostname(authHostname string) (string, error)

func GetAPIHostname

func GetAPIHostname() (string, error)

func GetActiveUserKey

func GetActiveUserKey() (string, error)

func GetSubject

func GetSubject() (string, error)

GetSubject returns the current user's subject (user ID) from stored credentials.

func GetTokenSource

func GetTokenSource(ctx context.Context) (oauth2.TokenSource, error)

Types

type StoredCredentials

type StoredCredentials struct {
	Hostname         string        `json:"hostname"`
	APIHostname      string        `json:"api_hostname"`
	ClientID         string        `json:"client_id"`
	EndpointAuthURL  string        `json:"endpoint_auth_url"`
	EndpointTokenURL string        `json:"endpoint_token_url"`
	Scopes           []string      `json:"scopes"`
	Token            *oauth2.Token `json:"token"`
	UserName         string        `json:"user_name"`
	UserEmail        string        `json:"user_email"`
	Subject          string        `json:"subject"`
}

func GetActiveCredentials

func GetActiveCredentials() (*StoredCredentials, string, error)

func GetStoredCredentials

func GetStoredCredentials(userKey string) (*StoredCredentials, error)

Jump to

Keyboard shortcuts

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