core

package
v1.0.1-0...-cbd2a5d Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModeProd = "prod"
	ModeDev  = "dev"
)
View Source
const Version = "v0.3.0"

Variables

This section is empty.

Functions

func ErrorHandler

func ErrorHandler(next clevergo.Handle) clevergo.Handle

func IsDevelopMode

func IsDevelopMode() bool

func NewDB

func NewDB() (*gorm.DB, error)

NewDB opens a database.

Types

type Authenticator

type Authenticator struct {
	Provider *oidc.Provider
	Config   oauth2.Config
	Ctx      context.Context
}

func NewAuthenticator

func NewAuthenticator(ctx context.Context) (*Authenticator, error)

type Handler

type Handler struct {
	DB             *sqlx.DB
	SessionManager *scs.SessionManager
}

func NewHandler

func NewHandler(db *sqlx.DB, sessionManager *scs.SessionManager) Handler

func (Handler) AddAlert

func (h Handler) AddAlert(ctx context.Context, a alert.Alert)

func (Handler) AddErrorAlert

func (h Handler) AddErrorAlert(ctx context.Context, err error)

func (Handler) UserID

func (h Handler) UserID(ctx context.Context) string

type MultiError

type MultiError []error

func (*MultiError) Add

func (me *MultiError) Add(err error)

func (*MultiError) Error

func (me *MultiError) Error() string

type SessionAuthenticator

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

func NewSessionAuthenticator

func NewSessionAuthenticator(sessionManager *scs.SessionManager) *SessionAuthenticator

func (*SessionAuthenticator) Authenticate

Authenticates the current user.

func (*SessionAuthenticator) Challenge

Challenge generates challenges upon authentication failure.

type User

type User struct {
	jwt.StandardClaims
	Email         string `json:"email"`
	EmailVerified bool   `json:"email_verified"`
	Name          string `json:"name"`
	Nickname      string `json:"nickname"`
	Picture       string `json:"picture"`
	AccessToken   string `json:"-"`
	IDToken       string `json:"-"`
}

func (User) GetID

func (u User) GetID() string

Jump to

Keyboard shortcuts

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