Documentation
¶
Index ¶
- Variables
- func BuildClearOidcStateCookieString(secure bool) string
- func BuildClearTokenCookieStringsFor(secure bool) []string
- func BuildOidcStateCookieString(value string, maxAgeInSeconds int, secure bool) string
- func BuildTokenCookieStringFor(maxAgeInSeconds int, token string, secure bool) string
- func ClearTokenCookie(w http.ResponseWriter, r *http.Request)
- func GetTokenCookie(r *http.Request) (string, error)
- func SecureCookieFromContext(ctx context.Context) bool
- func SecureCookieFromRequest(r *http.Request) bool
- func WithSecureCookieContext(ctx context.Context, secure bool) context.Context
Constants ¶
This section is empty.
Variables ¶
var ( TokenCookieName = "__Host-token" // #nosec G101: cookie name label, not a credential InsecureTokenCookieName = "token" // #nosec G101: cookie name label, not a credential OidcStateCookieName = "oidc_state" )
Functions ¶
func BuildClearOidcStateCookieString ¶
BuildClearOidcStateCookieString builds a Set-Cookie header string to clear the OIDC state cookie.
func BuildClearTokenCookieStringsFor ¶ added in v1.19.5
BuildClearTokenCookieStringsFor builds Set-Cookie header strings to clear token cookies matching the current request security context. Secure contexts also clear the HTTP fallback cookie so stale sessions from older releases are flushed instead of being re-presented forever.
func BuildOidcStateCookieString ¶
BuildOidcStateCookieString builds a Set-Cookie header string for the OIDC state cookie.
func BuildTokenCookieStringFor ¶ added in v1.19.5
BuildTokenCookieStringFor builds a Set-Cookie header string matching the current request security context. Callers must pass the trusted secure flag from SecureCookieFromContext / SecureCookieFromRequest so the cookie name (__Host-token vs. token) round-trips correctly behind HTTPS reverse proxies.
func ClearTokenCookie ¶
func ClearTokenCookie(w http.ResponseWriter, r *http.Request)
func SecureCookieFromContext ¶ added in v1.19.5
SecureCookieFromContext returns the secure-cookie decision that router middleware derived from TLS or trusted proxy headers.
func SecureCookieFromRequest ¶ added in v1.19.5
SecureCookieFromRequest returns true when the request was made over TLS or router middleware marked it as forwarded from HTTPS by a trusted proxy.
Types ¶
This section is empty.