web

package
v0.0.0-...-4806e31 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2021 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientIDTODO     = "8895e1e5f06644ebb41c26ea5740b246"
	ClientSecretTODO = "c1e847aef925467290b4302e64f3de4e"
)

Variables

This section is empty.

Functions

func New

func New(options ...Option) (*webApp, error)

New constructs an webApp.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	AccessToken  string `json:"access_token"`
	ExpiresAt    int64  `json:"expires_at"`
	TokenType    string `json:"token_type"`
	RefreshToken string `json:"refresh_token,omitempty"`
	Scope        string `json:"scope,omitempty"`
}

AccessTokenResponse holds the JSON response for an access token.

type AuthenticatedUser

type AuthenticatedUser struct {
	UserID   string
	Username string
	IsAdmin  bool
}

type Option

type Option func(*webApp)

Option defines functional option parameters for webApp.

func WithCSRFAuthKey

func WithCSRFAuthKey(csrfAuthKey []byte) Option

WithCSRFAuthKey is a functional option to inject a CSRF authentication key

func WithGoAuth2App

func WithGoAuth2App(goAuth2App *goauth2.App) Option

WithGoAuth2App is a functional option to inject a goauth2.App.

func WithHost

func WithHost(host string) Option

WithHost is a functional option to inject a tcp4 host.

func WithSessionKeyPair

func WithSessionKeyPair(sessionKeyPairs ...SessionKeyPair) Option

WithSessionKeyPair is a functional option to inject a session key pair.

Useful for rotating session authentication and encryption keys. Old sessions can still
be read because the first pair will fail, and the second will be tested.

func WithTemplateFS

func WithTemplateFS(f fs.FS) Option

WithTemplateFS is a functional option to inject a fs.FS

func WithUUIDGenerator

func WithUUIDGenerator(generator shortuuid.Generator) Option

WithUUIDGenerator is a functional option to inject a shortuuid.Generator.

type SavedEvents

type SavedEvents []rangedb.Event

SavedEvents contains events that have been persisted to the event store.

func (*SavedEvents) Contains

func (l *SavedEvents) Contains(events ...rangedb.Event) bool

Contains returns true if all events are found.

func (*SavedEvents) ContainsAny

func (l *SavedEvents) ContainsAny(events ...rangedb.Event) bool

ContainsAny returns true if any events are found.

func (*SavedEvents) Get

func (l *SavedEvents) Get(event rangedb.Event) bool

Get returns true if the event was found and stores the result in the value pointed to by event. If it is not found, Get returns false.

type SessionKeyPair

type SessionKeyPair struct {
	AuthenticationKey []byte
	EncryptionKey     []byte
}

SessionKeyPair holds the keys for a secure cookie session.

Jump to

Keyboard shortcuts

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