(auth *GinJWTMiddleware)
| 212 | } |
| 213 | |
| 214 | func 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 | |
| 236 | func TestMissingAuthenticatorForLoginHandler(t *testing.T) { |
| 237 | authMiddleware, err := New(&GinJWTMiddleware{ |
no test coverage detected
searching dependent graphs…