auth

package
v3.65.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: Apache-2.0 Copyright (c) 2025 Scott Friedman and Project Contributors

Index

Constants

View Source
const (
	// DefaultConfigFile is the default config file name
	DefaultConfigFile = "globus-cli-config"

	// DefaultTokenFile is the default token file name
	DefaultTokenFile = "globus-cli-token"

	// DefaultRedirectURI is the redirect URI for browser-based auth
	DefaultRedirectURI = "http://localhost:8080/callback"
)

Variables

This section is empty.

Functions

func IsTokenValid

func IsTokenValid(token *TokenInfo) bool

IsTokenValid checks if a token is still valid (not expired)

func LoginCommand

func LoginCommand(args []string) error

LoginCommand handles the login command

func LogoutCommand

func LogoutCommand(args []string) error

LogoutCommand handles the logout command

func TokenCommand

func TokenCommand(args []string) error

TokenCommand handles the token command

Types

type CallbackResult

type CallbackResult struct {
	Code  string
	State string
	Error error
}

CallbackResult holds the result of the OAuth callback

type CallbackServer

type CallbackServer struct {
	Server     *http.Server
	ResultChan chan CallbackResult
}

CallbackServer is a simple HTTP server for handling OAuth callbacks

type Config

type Config struct {
	ClientID     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	TokensDir    string `json:"tokens_dir"`
}

Config holds the CLI configuration

func LoadOrCreateConfig

func LoadOrCreateConfig() (*Config, error)

LoadOrCreateConfig loads the CLI configuration from disk

type TokenInfo

type TokenInfo struct {
	AccessToken  string    `json:"access_token"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	ExpiresIn    int       `json:"expires_in"`
	ExpiresAt    time.Time `json:"expires_at"`
	Scope        string    `json:"scope"`
	TokenType    string    `json:"token_type"`
	ResourceID   string    `json:"resource_id,omitempty"`
}

TokenInfo holds the token information

func LoadToken

func LoadToken(config *Config, tokenName string) (*TokenInfo, error)

LoadToken loads a token from disk

Jump to

Keyboard shortcuts

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