auth

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: Apache-2.0 Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const DefaultOAuthServerPort = 54520

DefaultOAuthServerPort is the default port for the OAuth server to listen for successful authentication

Variables

This section is empty.

Functions

func DefaultGetOAuthToken

func DefaultGetOAuthToken(ctx context.Context, authURL string, tokenURL string, opts ...TokenOption) (*oauth2.Token, error)

DefaultGetOAuthToken provides a default behavior for calling GetOAuthToken, using the --interative flag to determine whether to use interactive mode or non-interactive mode.

func GetOAuthToken

func GetOAuthToken(ctx context.Context, authURL string, tokenURL string, clientDetailsProvider client.DetailsProvider, opts ...TokenOption) (*oauth2.Token, error)

GetOAuthToken gets the OAuth token from the given OAuth server using the given client details provider.

Types

type Logger

type Logger func(format string, args ...any)

Logger is the type of logger used during OAuth token retrieval

type TokenOption

type TokenOption func(*TokenOptions)

TokenOption is an option for GetOAuthToken

func WithLogger

func WithLogger(logger Logger) TokenOption

WithLogger sets the logger

func WithOAuthServerPort

func WithOAuthServerPort(port int) TokenOption

WithOAuthServerPort sets the port on which the OAuth server should run

func WithScopes

func WithScopes(scopes ...string) TokenOption

WithScopes sets the OAuth scopes to be requested for the token.

type TokenOptions

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

TokenOptions contains options for GetOAuthToken

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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