Skip to content

Commit f09c35a

Browse files
authored
[installer] Change cookie name (#18958)
* [installer] Change cookie name * fix test * fix
1 parent 7f3b3c7 commit f09c35a

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

install/installer/pkg/components/auth/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,5 @@ func GetConfig(ctx *common.RenderContext) ([]corev1.Volume, []corev1.VolumeMount
5858
func cookieNameFromDomain(domain string) string {
5959
// replace all non-word characters with underscores
6060
derived := regexp.MustCompile(`[\W_]+`).ReplaceAllString(domain, "_")
61-
return "_" + derived + "_jwt_"
61+
return "_" + derived + "_jwt2_"
6262
}

install/installer/pkg/components/auth/config_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,42 +15,42 @@ func TestCookieNameFromDomain(t *testing.T) {
1515
{
1616
name: "Simple Domain",
1717
domain: "example.com",
18-
expectedOutcome: "_example_com_jwt_",
18+
expectedOutcome: "_example_com_jwt2_",
1919
},
2020
{
2121
name: "Domain with Underscore",
2222
domain: "example_test.com",
23-
expectedOutcome: "_example_test_com_jwt_",
23+
expectedOutcome: "_example_test_com_jwt2_",
2424
},
2525
{
2626
name: "Domain with Hyphen",
2727
domain: "example-test.com",
28-
expectedOutcome: "_example_test_com_jwt_",
28+
expectedOutcome: "_example_test_com_jwt2_",
2929
},
3030
{
3131
name: "Domain with Special Characters",
3232
domain: "example&test.com",
33-
expectedOutcome: "_example_test_com_jwt_",
33+
expectedOutcome: "_example_test_com_jwt2_",
3434
},
3535
{
3636
name: "Subdomain",
3737
domain: "subdomain.example.com",
38-
expectedOutcome: "_subdomain_example_com_jwt_",
38+
expectedOutcome: "_subdomain_example_com_jwt2_",
3939
},
4040
{
4141
name: "Subdomain with Hyphen",
4242
domain: "sub-domain.example.com",
43-
expectedOutcome: "_sub_domain_example_com_jwt_",
43+
expectedOutcome: "_sub_domain_example_com_jwt2_",
4444
},
4545
{
4646
name: "Subdomain with Underscore",
4747
domain: "sub_domain.example.com",
48-
expectedOutcome: "_sub_domain_example_com_jwt_",
48+
expectedOutcome: "_sub_domain_example_com_jwt2_",
4949
},
5050
{
5151
name: "Subdomain with Special Characters",
5252
domain: "sub&domain.example.com",
53-
expectedOutcome: "_sub_domain_example_com_jwt_",
53+
expectedOutcome: "_sub_domain_example_com_jwt2_",
5454
},
5555
}
5656

install/installer/pkg/components/public-api-server/configmap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func TestConfigMap(t *testing.T) {
6363
LifetimeSeconds: int64((24 * 7 * time.Hour).Seconds()),
6464
Issuer: "https://test.domain.everything.awesome.is",
6565
Cookie: config.CookieConfig{
66-
Name: "_test_domain_everything_awesome_is_jwt_",
66+
Name: "_test_domain_everything_awesome_is_jwt2_",
6767
MaxAge: int64((24 * 7 * time.Hour).Seconds()),
6868
SameSite: "lax",
6969
Secure: true,

install/installer/pkg/components/server/configmap_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func TestConfigMap(t *testing.T) {
6969
LifetimeSeconds: int64((7 * 24 * time.Hour).Seconds()),
7070
Issuer: "https://awesome.domain",
7171
Cookie: auth.CookieConfig{
72-
Name: "_awesome_domain_jwt_",
72+
Name: "_awesome_domain_jwt2_",
7373
MaxAge: int64((7 * 24 * time.Hour).Seconds()),
7474
SameSite: "lax",
7575
Secure: true,

0 commit comments

Comments
 (0)