Registry / auth / appleboy-gin-jwt

appleboy-gin-jwt

JSON →
library2.5.0+incompatiblegogounverified

JWT authentication middleware for the Gin web framework.

go get github.com/appleboy/gin-jwt
INSTALL
IMPORT
SIG · APPLEBOY-GIN-JWT
A
appleboy-gin-jwt
authgov2.5.0+incompatible
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ginjwt
github.com/appleboy/gin-jwt

Sets up JWT authentication with Gin.

package main import ( "github.com/appleboy/gin-jwt" "github.com/gin-gonic/gin" ) func main() { r := gin.Default() authMiddleware, _ := ginjwt.New(&ginjwt.GinJWTMiddleware{ Realm: "test zone", Key: []byte("secret key"), Timeout: time.Hour, MaxRefresh: time.Hour, Authenticator: func(userId string, password string, c *gin.Context) (string, bool) { if userId == "admin" && password == "admin" { return userId, true } return userId, false }, }) r.POST("/login", authMiddleware.LoginHandler) r.Run() }
Debug
Known issues
breakingVersion 2.x uses a different API than v1; the middleware struct and handler registration changed.
fix
Use v2 API: ginjwt.New with GinJWTMiddleware struct and authMiddleware.MiddlewareFunc().
affects: >=2.0.0
Upgrade
Version history
2.5.0+incompatiblelatest on pkg.go.dev
Audit
Dependencies

No dependency data recorded yet.

Agent activity
43 hits · last 30 days
node
38
Resources
appleboy-gin-jwt — go get appleboy-gin-jwt · libregistry