storage

package
v0.0.0-...-f284455 Latest Latest
Warning

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

Go to latest
Published: May 19, 2019 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound       = errors.New("not found")
	ErrAlreadyExists  = errors.New("already exists")
	ErrNotImplemented = errors.New("not implemented")
)

Functions

func CRUDCheckRun

func CRUDCheckRun(t *testing.T, s Storage)

Types

type AuthCode

type AuthCode struct {
	ID       string
	ClientID string

	CodeChallenge       string
	CodeChallengeMethod string

	//ProviderID string // todo(n.rodionov)
	//Expiry time.Time  // todo(n.rodionov)
	Claims Claims
}

type AuthRequest

type AuthRequest struct {
	ID           string
	ClientID     string
	RedirectURI  string
	State        string
	ResponseType string

	// PKCE extension
	CodeChallenge       string
	CodeChallengeMethod string

	Claims Claims
}

todo(n.rodionov): make similar struct in auth module

type Claims

type Claims struct {
	UserID    string
	UserEmail string
}

type Credentials

type Credentials interface {
	UID() string
}

type Storage

type Storage interface {
	Close() error

	// todo: move provider into separate storage
	ProviderCreate(pid string) error

	UserCreate(pid string, c Credentials) error
	UserRead(pid string, uid string) (Credentials, error)
	UserUpdate(pid string, uid string, updater func(c Credentials) (Credentials, error)) error
	UserDelete(pid string, uid string) error

	AuthRequestCreate(a AuthRequest) error
	AuthRequestRead(uid string) (AuthRequest, error)
	AuthRequestUpdate(uid string, updater func(a AuthRequest) (AuthRequest, error)) error
	AuthRequestDelete(uid string) error

	AuthCodeCreate(a AuthCode) error
	AuthCodeRead(uid string) (AuthCode, error)
	AuthCodeDelete(uid string) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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