app

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2017 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("Object not found")

ErrNotFound represents an object not found error

Functions

This section is empty.

Types

type Context

type Context struct {
	echo.Context
}

Context wraps echo.context to provide userful WeCHY information

func (*Context) Claims

func (ctx *Context) Claims() *WechyClaims

Claims returns authenticated user claims

func (*Context) Failure

func (ctx *Context) Failure(err error) error

Failure returns a 500 page

func (*Context) IsAuthenticated

func (ctx *Context) IsAuthenticated() bool

IsAuthenticated returns true if user is authenticated

func (*Context) NotFound

func (ctx *Context) NotFound() error

NotFound returns a 404 page

func (*Context) ParamAsInt

func (ctx *Context) ParamAsInt(name string) (int, error)

ParamAsInt returns parameter as int

func (*Context) SetClaims

func (ctx *Context) SetClaims(claims *WechyClaims)

SetClaims update HTTP context with current claims

func (*Context) SetTenant

func (ctx *Context) SetTenant(tenant *Tenant)

SetTenant update HTTP context with current tenant

func (*Context) Tenant

func (ctx *Context) Tenant() *Tenant

Tenant returns current tenant

type HTMLRenderer

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

HTMLRenderer renderer

func NewHTMLRenderer

func NewHTMLRenderer(logger echo.Logger) *HTMLRenderer

NewHTMLRenderer creates a new HTMLRenderer

func (*HTMLRenderer) Render

func (r *HTMLRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Render a template based on parameters

type HandlerFunc

type HandlerFunc func(Context) error

HandlerFunc represents an HTTP handler

type MiddlewareFunc

type MiddlewareFunc func(HandlerFunc) HandlerFunc

MiddlewareFunc represents an HTTP middleware

func OneYearCache

func OneYearCache() MiddlewareFunc

OneYearCache adds Cache-Control header for one year

type Tenant

type Tenant struct {
	ID     int    `json:"id"`
	Name   string `json:"name"`
	Domain string `json:"domain"`
}

Tenant represents a tenant

type User

type User struct {
	ID        int             `json:"id"`
	Name      string          `json:"name"`
	Email     string          `json:"email"`
	Providers []*UserProvider `json:"providers"`
}

User represents an user inside our application

type UserProvider

type UserProvider struct {
	Name string `json:"name"`
	UID  string `json:"uid"`
}

UserProvider represents the relashionship between an User and an Authentication provide

type WechyClaims

type WechyClaims struct {
	UserID    int    `json:"user/id"`
	UserName  string `json:"user/name"`
	UserEmail string `json:"user/email"`
	jwt.StandardClaims
}

WechyClaims represents what goes into JWT tokens

Directories

Path Synopsis
toolbox
env

Jump to

Keyboard shortcuts

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