mirror of
https://github.com/gitpod-io/gitpod.git
synced 2025-12-08 17:36:30 +00:00
* Use `__Host-` prefix for cookie * Fix tests * Remove domain from cookie * Fix logout * remove unused fn * fix user logout properly * [server] Make domain-only cookie work for GitHub oauth login ... by adding additional step so we can set the cookie for the base domain only * test: fix by redirecting before callbacl/authorize * [server] SessionHandler: Allow to login with both primary and secondary cookies * [server] Clear 2ndary cookie on logout * Fix filtering cookie values when primary cookie is empty * Fix logouts * Fix tests --------- Co-authored-by: Gero Posmyk-Leinemann <gero@gitpod.io>
14 lines
436 B
Go
14 lines
436 B
Go
// Copyright (c) 2024 Gitpod GmbH. All rights reserved.
|
|
// Licensed under the GNU Affero General Public License (AGPL).
|
|
// See License.AGPL.txt in the project root for license information.
|
|
|
|
package lib
|
|
|
|
import "regexp"
|
|
|
|
func CookieNameFromDomain(domain string) string {
|
|
// replace all non-word characters with underscores
|
|
derived := regexp.MustCompile(`[\W_]+`).ReplaceAllString(domain, "_")
|
|
return "__Host-_" + derived + "_jwt2_"
|
|
}
|