DeleteToken removes the token found in the context from the storage and expires the CSRF cookie
(c fiber.Ctx)
| 326 | // DeleteToken removes the token found in the context from the storage |
| 327 | // and expires the CSRF cookie |
| 328 | func (handler *Handler) DeleteToken(c fiber.Ctx) error { |
| 329 | // Extract token from the client request cookie |
| 330 | cookieToken := c.Cookies(handler.config.CookieName) |
| 331 | if cookieToken == "" { |
| 332 | return handler.config.ErrorHandler(c, ErrTokenNotFound) |
| 333 | } |
| 334 | // Remove the token from storage |
| 335 | if err := deleteTokenFromStorage(c, cookieToken, &handler.config, handler.sessionManager, handler.storageManager); err != nil { |
| 336 | return handler.config.ErrorHandler(c, err) |
| 337 | } |
| 338 | // Expire the cookie |
| 339 | expireCSRFCookie(c, &handler.config) |
| 340 | return nil |
| 341 | } |
| 342 | |
| 343 | func validateSecFetchSite(c fiber.Ctx) error { |
| 344 | secFetchSite := utils.Trim(c.Get(fiber.HeaderSecFetchSite), ' ') |