Documentation ¶
Index ¶
- func AuthedFrom(ctx context.Context) *model.User
- func Authenticate(secret []byte, users *store.Users) func(http.Handler) http.Handler
- func Authorize(roles ...model.UserRole) func(http.Handler) http.Handler
- func ExtractJwtToken(r *http.Request) (string, error)
- func GenerateJwtToken(issuer string, expireAfter time.Duration, secret []byte, user *model.User) (string, error)
- func ImageFrom(ctx context.Context) *model.Image
- func JSON(r *http.Request, v interface{}) error
- func Pagination(pageName, sizeName string, defaultSize int64) func(http.Handler) http.Handler
- func ParseJwtClaims(jwtToken string, secret []byte, claims jwt.Claims) error
- func PinlFrom(ctx context.Context) *model.Pinl
- func PkgFrom(ctx context.Context) *model.Pkg
- func QueryBool(r *http.Request, paramName string) field.NullBool
- func QueryCsv(r *http.Request, paramName string) []string
- func ShareFrom(ctx context.Context) *model.Share
- func SharetagFrom(ctx context.Context) *model.Sharetag
- func TagFrom(ctx context.Context) *model.Tag
- func UserFrom(ctx context.Context) *model.User
- func WithAuthed(ctx context.Context, user *model.User) context.Context
- func WithImage(ctx context.Context, image *model.Image) context.Context
- func WithPaginator(ctx context.Context, p *Paginator) context.Context
- func WithPinl(ctx context.Context, pinl *model.Pinl) context.Context
- func WithPkg(ctx context.Context, pkg *model.Pkg) context.Context
- func WithShare(ctx context.Context, share *model.Share) context.Context
- func WithSharetag(ctx context.Context, sharetag *model.Sharetag) context.Context
- func WithTag(ctx context.Context, tag *model.Tag) context.Context
- func WithUser(ctx context.Context, user *model.User) context.Context
- type AuthClaims
- type ContextKey
- type Paginator
- type PinlQuery
- type PkgQuery
- type StatQuery
- type TagQuery
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Authenticate ¶
func GenerateJwtToken ¶
func Pagination ¶
func ParseJwtClaims ¶
func WithSharetag ¶
Types ¶
type AuthClaims ¶
type ContextKey ¶
type ContextKey int
const ( PaginatorCtxKey ContextKey = iota AuthedCtxKey UserCtxKey PinlCtxKey PkgCtxKey TagCtxKey ImageCtxKey )
Click to show internal directories.
Click to hide internal directories.