mirror of
https://github.com/oauth2-proxy/oauth2-proxy.git
synced 2026-10-20 17:51:37 +02:00
Rename Cookie Options to remove extra 'Cookie'
This commit is contained in:
@@ -38,19 +38,19 @@ func MakeCookie(req *http.Request, name string, value string, path string, domai
|
||||
|
||||
// MakeCookieFromOptions constructs a cookie based on the given *options.CookieOptions,
|
||||
// value and creation time
|
||||
func MakeCookieFromOptions(req *http.Request, name string, value string, opts *options.CookieOptions, expiration time.Duration, now time.Time) *http.Cookie {
|
||||
domain := GetCookieDomain(req, opts.CookieDomains)
|
||||
func MakeCookieFromOptions(req *http.Request, name string, value string, cookieOpts *options.CookieOptions, expiration time.Duration, now time.Time) *http.Cookie {
|
||||
domain := GetCookieDomain(req, cookieOpts.Domains)
|
||||
|
||||
if domain != "" {
|
||||
return MakeCookie(req, name, value, opts.CookiePath, domain, opts.CookieHTTPOnly, opts.CookieSecure, expiration, now, ParseSameSite(opts.CookieSameSite))
|
||||
return MakeCookie(req, name, value, cookieOpts.Path, domain, cookieOpts.HTTPOnly, cookieOpts.Secure, expiration, now, ParseSameSite(cookieOpts.SameSite))
|
||||
}
|
||||
// If nothing matches, create the cookie with the shortest domain
|
||||
logger.Printf("Warning: request host %q did not match any of the specific cookie domains of %q", GetRequestHost(req), strings.Join(opts.CookieDomains, ","))
|
||||
logger.Printf("Warning: request host %q did not match any of the specific cookie domains of %q", GetRequestHost(req), strings.Join(cookieOpts.Domains, ","))
|
||||
defaultDomain := ""
|
||||
if len(opts.CookieDomains) > 0 {
|
||||
defaultDomain = opts.CookieDomains[len(opts.CookieDomains)-1]
|
||||
if len(cookieOpts.Domains) > 0 {
|
||||
defaultDomain = cookieOpts.Domains[len(cookieOpts.Domains)-1]
|
||||
}
|
||||
return MakeCookie(req, name, value, opts.CookiePath, defaultDomain, opts.CookieHTTPOnly, opts.CookieSecure, expiration, now, ParseSameSite(opts.CookieSameSite))
|
||||
return MakeCookie(req, name, value, cookieOpts.Path, defaultDomain, cookieOpts.HTTPOnly, cookieOpts.Secure, expiration, now, ParseSameSite(cookieOpts.SameSite))
|
||||
}
|
||||
|
||||
// GetCookieDomain returns the correct cookie domain given a list of domains
|
||||
|
||||
Reference in New Issue
Block a user