ParseSameSite converts a string ("lax", "strict", "none") to http.SameSite. Defaults to Lax for unrecognized values. The CLI flag --app-cookie-same-site defaults to "none" for backward compatibility with cross-domain SDK setups.
(value string)
| 15 | // Defaults to Lax for unrecognized values. The CLI flag --app-cookie-same-site |
| 16 | // defaults to "none" for backward compatibility with cross-domain SDK setups. |
| 17 | func ParseSameSite(value string) http.SameSite { |
| 18 | switch strings.ToLower(strings.TrimSpace(value)) { |
| 19 | case "none": |
| 20 | return http.SameSiteNoneMode |
| 21 | case "strict": |
| 22 | return http.SameSiteStrictMode |
| 23 | default: |
| 24 | return http.SameSiteLaxMode |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // SetSession sets the session cookie in the response. |
| 29 | func SetSession(gc *gin.Context, sessionID string, appCookieSecure bool, sameSite http.SameSite) { |
no outgoing calls