auth

package
v0.0.0-...-6e4d973 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package auth provides the authentication logic for the application

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthToken

type AuthToken struct {
	AccessToken  string    `yaml:"access_token"`
	RefreshToken string    `yaml:"refresh_token"`
	TokenType    string    `yaml:"token_type"`
	Expiry       time.Time `yaml:"expiry"`
}

func NewAuthToken

func NewAuthToken(accessToken, refreshToken, tokenType string, expiry time.Time) *AuthToken

func StartOAuthFlow

func StartOAuthFlow(
	ctx context.Context,
	oauthConf oauth2.Config,
	redirectPort,
	redirectPath,
	credentialFilePath string,
) (*AuthToken, error)

StartOAuthFlow starts the OAuth flow

func (*AuthToken) IsExpired

func (t *AuthToken) IsExpired() bool

func (*AuthToken) Load

func (t *AuthToken) Load(decoder *yaml.Decoder) error

func (*AuthToken) Refresh

func (t *AuthToken) Refresh(ctx context.Context, config *oauth2.Config, credentialFilePath string) error

func (*AuthToken) Save

func (t *AuthToken) Save(encoder *yaml.Encoder) error

func (*AuthToken) SetAuthHeader

func (t *AuthToken) SetAuthHeader(r *http.Request)

Jump to

Keyboard shortcuts

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