MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / makeStateCookie

Method makeStateCookie

rest/oidc_api.go:334–349  ·  view source on GitHub ↗

makeStateCookie creates a new state cookie with the specified value and Max-Age. Max-Age has precedence whilst determining the state cookie expiration even though both Expires and Max-Age are set.

(value string, maxAge int)

Source from the content-addressed store, hash-verified

332// Max-Age has precedence whilst determining the state cookie expiration even though
333// both Expires and Max-Age are set.
334func (h *handler) makeStateCookie(value string, maxAge int) *http.Cookie {
335 cookie := &http.Cookie{
336 Name: stateCookieName,
337 Value: value,
338 HttpOnly: true,
339 MaxAge: maxAge,
340 }
341 if h.rq.TLS != nil {
342 cookie.Secure = true
343 }
344 if maxAge > 0 {
345 cookie.Expires = time.Now().Add(time.Duration(maxAge) * time.Second)
346 }
347 base.AddDbPathToCookie(h.rq, cookie)
348 return cookie
349}

Callers 2

handleOIDCCommonMethod · 0.95
handleOIDCCallbackMethod · 0.95

Calls 2

AddDbPathToCookieFunction · 0.92
AddMethod · 0.45

Tested by

no test coverage detected