auth

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: AGPL-3.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MinKeyLen = 32

Variables

View Source
var (
	ErrAlreadyRegistered = errors.New("registration failed: already registered")
)

Functions

This section is empty.

Types

type CachedSession

type CachedSession struct {
	ClientID       string
	ExpirationDate time.Time
}

type Service

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

func NewService

func NewService(store store.Store, sessionCache *SessionCache) (*Service, error)

func (*Service) Authenticate

func (s *Service) Authenticate(id, authToken string) error

func (*Service) Login

func (s *Service) Login(id, key string) (string, error)

func (*Service) Register

func (s *Service) Register(id, key string) error

func (*Service) Unregister

func (s *Service) Unregister(id string) error

type SessionCache

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

func NewSessionCache

func NewSessionCache(cfg SessionCacheConfig) (*SessionCache, error)

func (*SessionCache) Delete

func (t *SessionCache) Delete(clientID string)

func (*SessionCache) Get

func (t *SessionCache) Get(token string) (CachedSession, error)

func (*SessionCache) Put

func (t *SessionCache) Put(clientID, token string) error

type SessionCacheConfig

type SessionCacheConfig struct {
	ExpirationMinutes int `toml:"expiration_minutes"`
}

func (SessionCacheConfig) IsValid

func (c SessionCacheConfig) IsValid() error

Jump to

Keyboard shortcuts

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