auth

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CalendarAuth

type CalendarAuth struct {
	CalendarID string
	OAuth2     OAuth2Object
}

type Client

type Client struct {
	Id     string
	Secret string
}

type Credentials

type Credentials struct {
	Client     Client
	Tenant     Tenant
	CalendarId string
}

type EncryptedFile

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

EncryptedFile offers

func NewEncryptedFile

func NewEncryptedFile(file io.ReadWriter, passphrase string) *EncryptedFile

NewEncryptedFile takes the upstream io.ReadWriteCloser and a passphrase to setup an EncryptedFile The actual encryption or decryption setup will happen lazy on the first read or write

func (*EncryptedFile) Close

func (e *EncryptedFile) Close() error

Close implements the io.Closer interface If ever data was encrypted, this closes the encryption stream

func (*EncryptedFile) Read

func (e *EncryptedFile) Read(p []byte) (n int, err error)

Read implement the io.Reader interface. On first call, this sets up the age decryption infrastructure

func (*EncryptedFile) Write

func (e *EncryptedFile) Write(p []byte) (n int, err error)

Write implement the io.Writer interface. On first call, this sets up the age encryption infrastructure

type OAuth2Object

type OAuth2Object struct {
	AccessToken  string
	RefreshToken string
	Expiry       string
	TokenType    string
}

type OAuthHandler

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

func NewOAuthHandler

func NewOAuthHandler(config oauth2.Config, bindPort uint) (*OAuthHandler, error)

func (*OAuthHandler) Configuration

func (l *OAuthHandler) Configuration() *oauth2.Config

func (*OAuthHandler) Listen

func (l *OAuthHandler) Listen(ctx context.Context) error

Listen is meant to be called as goroutine. Once your handler has finished, just cancel the context and the http server will shut down.

func (*OAuthHandler) Token

func (l *OAuthHandler) Token() *oauth2.Token

type Storage

type Storage interface {
	WriteCalendarAuth(CalendarAuth) (bool, error)
	ReadCalendarAuth(calendarID string) (*CalendarAuth, error)
	RemoveCalendarAuth(calendarID string) error
	Setup(config config.AuthStorage, encryptionPassphrase string) error
}

func NewStorageAdapterFromConfig

func NewStorageAdapterFromConfig(ctx context.Context, config config.AuthStorage, encryptionPassphrase string) (Storage, error)

func StorageFactory

func StorageFactory(typ string) (Storage, error)

type Tenant

type Tenant struct {
	Id string
}

type YamlStorage

type YamlStorage struct {
	StoragePath          string
	StorageEncryptionKey string
	// Holds the decrypted CalendarAuth Config in memory, so the file does not have to be read multiple times
	CachedAuth []CalendarAuth
}

func (*YamlStorage) ReadCalendarAuth

func (y *YamlStorage) ReadCalendarAuth(calendarID string) (*CalendarAuth, error)

func (*YamlStorage) RemoveCalendarAuth

func (y *YamlStorage) RemoveCalendarAuth(calendarID string) error

func (*YamlStorage) Setup

func (y *YamlStorage) Setup(config config.AuthStorage, encryptionPassphrase string) error

func (*YamlStorage) WriteCalendarAuth

func (y *YamlStorage) WriteCalendarAuth(newCal CalendarAuth) (bool, error)

Jump to

Keyboard shortcuts

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