MCPcopy
hub / github.com/appleboy/gin-jwt / ginHandler

Function ginHandler

auth_jwt_test.go:214–234  ·  view source on GitHub ↗
(auth *GinJWTMiddleware)

Source from the content-addressed store, hash-verified

212}
213
214func ginHandler(auth *GinJWTMiddleware) *gin.Engine {
215 gin.SetMode(gin.TestMode)
216 r := gin.New()
217
218 r.POST("/login", auth.LoginHandler)
219 r.POST("/logout", auth.LogoutHandler)
220 r.POST("/refresh", auth.RefreshHandler)
221
222 group := r.Group("/auth")
223 // Refresh time can be longer than token timeout
224 group.POST("/refresh_token", auth.RefreshHandler)
225 group.Use(auth.MiddlewareFunc())
226 {
227 group.GET("/hello", helloHandler)
228 }
229
230 // Add back the param-based endpoint for testing
231 r.GET("/g/:token/hello", auth.MiddlewareFunc(), helloHandler)
232
233 return r
234}
235
236func TestMissingAuthenticatorForLoginHandler(t *testing.T) {
237 authMiddleware, err := New(&GinJWTMiddleware{

Callers 15

TestLoginHandlerFunction · 0.85
TestParseTokenFunction · 0.85
TestParseTokenRS256Function · 0.85
TestParseTokenKeyFuncFunction · 0.85
TestRefreshHandlerRS256Function · 0.85
TestRefreshHandlerFunction · 0.85
TestValidRefreshTokenFunction · 0.85
TestAuthorizerFunction · 0.85

Calls 1

MiddlewareFuncMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…