(c fiber.Ctx, cfg *Config, token string, expiry time.Duration)
| 307 | } |
| 308 | |
| 309 | func setCSRFCookie(c fiber.Ctx, cfg *Config, token string, expiry time.Duration) { |
| 310 | cookie := &fiber.Cookie{ |
| 311 | Name: cfg.CookieName, |
| 312 | Value: token, |
| 313 | Domain: cfg.CookieDomain, |
| 314 | Path: cfg.CookiePath, |
| 315 | Secure: cfg.CookieSecure, |
| 316 | HTTPOnly: cfg.CookieHTTPOnly, |
| 317 | SameSite: cfg.CookieSameSite, |
| 318 | SessionOnly: cfg.CookieSessionOnly, |
| 319 | Expires: time.Now().Add(expiry), |
| 320 | } |
| 321 | |
| 322 | // Set the CSRF cookie to the response |
| 323 | c.Cookie(cookie) |
| 324 | } |
| 325 | |
| 326 | // DeleteToken removes the token found in the context from the storage |
| 327 | // and expires the CSRF cookie |
no test coverage detected