web

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2017 License: MIT Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LimitArticle = 3
	LimitLinks   = 10
)

Variables

This section is empty.

Functions

func BadRequestHandler

func BadRequestHandler(rw http.ResponseWriter, r *http.Request)

func DeleteTGC

func DeleteTGC(sess *sessions.Session)

func GetClientIP

func GetClientIP(req *http.Request) (ip string)

func GetTGC

func GetTGC(sess *sessions.Session) *cas.Ticket

func InGroup

func InGroup(gn, uid string) bool

func IsKeeper

func IsKeeper(uid string) bool

func New

func New() *webImpl

func NewServerConfig

func NewServerConfig() *osin.ServerConfig

func NewTGC

func NewTGC(sess *sessions.Session, ticket *cas.Ticket)

func NotFoundHandler

func NotFoundHandler(rw http.ResponseWriter, r *http.Request)

func T

func T(name string) *template.Template

Types

type AccessTokenGenJWT

type AccessTokenGenJWT struct {
	Key []byte
}

JWT access token generator

func (*AccessTokenGenJWT) GenerateAccessToken

func (c *AccessTokenGenJWT) GenerateAccessToken(data *osin.AccessData, generaterefresh bool) (accesstoken string, refreshtoken string, err error)

type Context

type Context struct {
	Request   *http.Request
	Writer    http.ResponseWriter
	Vars      map[string]string
	Session   *sessions.Session
	ResUrl    string
	User      *User
	LastUid   string
	NavSimple bool
	Referer   string
	Version   string
}

func NewContext

func NewContext(w http.ResponseWriter, req *http.Request, sess *sessions.Session) *Context

func (*Context) Close

func (c *Context) Close()

func (*Context) Halt

func (ctx *Context) Halt(code int, reason string)

func (*Context) IsAjax

func (ctx *Context) IsAjax() bool

func (*Context) IsUserExpired

func (c *Context) IsUserExpired() bool

func (*Context) Redirect

func (ctx *Context) Redirect(path string)

func (*Context) Render

func (ctx *Context) Render(tpl string, data interface{}) error

type User

type User struct {
	Uid     string `json:"uid"`
	Name    string `json:"name"`
	LastHit int64  `json:"-"`
}

func UserFromStaff

func UserFromStaff(staff *models.Staff) *User

func (*User) InGroup

func (u *User) InGroup(gn string) bool

func (*User) IsExpired

func (u *User) IsExpired() bool

func (*User) IsKeeper

func (u *User) IsKeeper() bool

func (*User) Refresh

func (u *User) Refresh()

refresh lastHit to time Unix

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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