replace zxq.co/ripple/hanayo
This commit is contained in:
20
vendor/github.com/gin-gonic/contrib/jwt/jwt.go
generated
vendored
Normal file
20
vendor/github.com/gin-gonic/contrib/jwt/jwt.go
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
package jwt
|
||||
|
||||
import (
|
||||
jwt_lib "github.com/dgrijalva/jwt-go"
|
||||
"github.com/dgrijalva/jwt-go/request"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Auth(secret string) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
_, err := request.ParseFromRequest(c.Request, request.OAuth2Extractor, func(token *jwt_lib.Token) (interface{}, error) {
|
||||
b := ([]byte(secret))
|
||||
return b, nil
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
c.AbortWithError(401, err)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user