SetSession sets the session cookie in the response.
(gc *gin.Context, sessionID string, appCookieSecure bool, sameSite http.SameSite)
| 27 | |
| 28 | // SetSession sets the session cookie in the response. |
| 29 | func SetSession(gc *gin.Context, sessionID string, appCookieSecure bool, sameSite http.SameSite) { |
| 30 | for _, c := range BuildSessionCookies(parsers.GetHost(gc), sessionID, appCookieSecure, sameSite) { |
| 31 | gc.SetSameSite(c.SameSite) |
| 32 | gc.SetCookie(c.Name, c.Value, c.MaxAge, c.Path, c.Domain, c.Secure, c.HttpOnly) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | // BuildSessionCookies returns the pair of session cookies (host-scoped and |
| 37 | // domain-scoped) to set on the response. Transport-agnostic so non-gin |
no test coverage detected