MCPcopy
hub / github.com/gofiber/fiber / setCSRFCookie

Function setCSRFCookie

middleware/csrf/csrf.go:309–324  ·  view source on GitHub ↗
(c fiber.Ctx, cfg *Config, token string, expiry time.Duration)

Source from the content-addressed store, hash-verified

307}
308
309func 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

Callers 2

updateCSRFCookieFunction · 0.85
expireCSRFCookieFunction · 0.85

Calls 3

AddMethod · 0.65
CookieMethod · 0.65
NowMethod · 0.45

Tested by

no test coverage detected