web

package
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2017 License: MIT Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LimitArticle = 3
	LimitLinks   = 10
)
View Source
const (
	LoginPath = "/login"
)

Variables

View Source
var (
	CookieName = "_user"
)

Functions

func AuthUserMiddleware added in v0.6.3

func AuthUserMiddleware() gin.HandlerFunc

func DeleteTGC

func DeleteTGC(c *gin.Context)

func GetTGC

func GetTGC(c *gin.Context) *cas.Ticket

func IsAjax added in v0.6.3

func IsAjax(r *http.Request) bool

func New

func New() *server

func NewTGC

func NewTGC(c *gin.Context, ticket *cas.Ticket)

func Render added in v0.6.3

func Render(c *gin.Context, name string, data interface{}) (err error)

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 User

type User struct {
	Uid     string `json:"uid"`
	Name    string `json:"name"`
	LastHit int64  `json:"-"`
	// contains filtered or unexported fields
}

func UserFromRequest added in v0.6.3

func UserFromRequest(r *http.Request) (user *User, err error)

func UserFromStaff

func UserFromStaff(staff *models.Staff) *User

func UserWithContext added in v0.6.3

func UserWithContext(c *gin.Context) (user *User)

func (*User) Decode added in v0.6.3

func (u *User) Decode(b []byte) (err error)

func (*User) DecodeMsgpack added in v0.6.3

func (u *User) DecodeMsgpack(dec *msgpack.Decoder) error

func (User) Encode added in v0.6.3

func (u User) Encode() (b []byte, err error)

func (*User) EncodeMsgpack added in v0.6.3

func (u *User) EncodeMsgpack(enc *msgpack.Encoder) error

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