1
0
mirror of https://github.com/labstack/echo.git synced 2025-06-15 00:14:57 +02:00

Flexible handler and middleware

Signed-off-by: Vishal Rana <vr@labstack.com>
This commit is contained in:
Vishal Rana
2015-03-25 08:50:24 -07:00
parent 99124cda0a
commit e49e74aeac
8 changed files with 138 additions and 86 deletions

View File

@ -10,10 +10,10 @@ import (
)
type (
BasicAuthFunc func(usr, pwd string) bool
BasicAuthFunc func(string, string) bool
AuthorizedHandler bolt.HandlerFunc
UnauthorizedHandler func(c *bolt.Context, err error)
JwtKeyFunc func(kid string) ([]byte, error)
UnauthorizedHandler func(*bolt.Context, error)
JwtKeyFunc func(string) ([]byte, error)
Claims map[string]interface{}
)
@ -57,7 +57,7 @@ func JwtAuth(ah AuthorizedHandler, uah UnauthorizedHandler, fn JwtKeyFunc) bolt.
if t.Valid {
c.Set("claims", Claims(t.Claims))
ah(c)
c.Next()
// c.Next()
} else {
// TODO: capture errors
uah(c, err)