Skip to content

Commit

Permalink
Updated gold compare configs and fixed lint styles
Browse files Browse the repository at this point in the history
  • Loading branch information
meson800 committed Apr 24, 2023
1 parent 6fda090 commit 5d72a5b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 11 deletions.
13 changes: 6 additions & 7 deletions cmd/headscale/cli/mockoidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,16 @@ func mockOIDC() error {
}
accessTTL = newTTL
}

mockUsers := os.Getenv("MOCKOIDC_USERS")
users := []mockoidc.User{}
if mockUsers != "" {
user_strings := strings.Split(mockUsers, ",")
user_re := regexp.MustCompile(`^\s*(?P<username>\S+)\s*<(?P<email>\S+@\S+)>\s*$`)
for _, v := range user_strings {
match := user_re.FindStringSubmatch(v)
userStrings := strings.Split(mockUsers, ",")
userRe := regexp.MustCompile(`^\s*(?P<username>\S+)\s*<(?P<email>\S+@\S+)>\s*$`)
for _, v := range userStrings {
match := userRe.FindStringSubmatch(v)
if match != nil {
fmt.Println("Success!", match[1], match[2])
// Use the default mockoidc entries for other entries
// Use the default mockoidc claims for other entries
users = append(users, &mockoidc.MockUser{
Subject: "1234567890",
Email: match[2],
Expand Down
8 changes: 4 additions & 4 deletions integration/auth_oidc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func TestOIDCUsernameGrant(t *testing.T) {
for i := range users {
users[i] = "test-user <test-email@example.com>"
}
user_str := strings.Join(users, ", ")
userStr := strings.Join(users, ", ")

oidcConfig, err := scenario.runMockOIDC(defaultAccessTTL, user_str)
oidcConfig, err := scenario.runMockOIDC(defaultAccessTTL, userStr)
if err != nil {
t.Errorf("failed to run mock OIDC server: %s", err)
}
Expand Down Expand Up @@ -146,9 +146,9 @@ func TestOIDCEmailGrant(t *testing.T) {
for i := range users {
users[i] = "test-user <test-email@example.com>"
}
user_str := strings.Join(users, ", ")
userStr := strings.Join(users, ", ")

oidcConfig, err := scenario.runMockOIDC(defaultAccessTTL, user_str)
oidcConfig, err := scenario.runMockOIDC(defaultAccessTTL, userStr)
if err != nil {
t.Errorf("failed to run mock OIDC server: %s", err)
}
Expand Down
1 change: 1 addition & 0 deletions integration_test/etc/alt-config.dump.gold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ oidc:
- profile
- email
strip_email_domain: true
use_username_claim: false
use_expiry_from_token: false
private_key_path: private.key
noise:
Expand Down
1 change: 1 addition & 0 deletions integration_test/etc/alt-env-config.dump.gold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ oidc:
- profile
- email
strip_email_domain: true
use_username_claim: false
use_expiry_from_token: false
private_key_path: private.key
noise:
Expand Down
1 change: 1 addition & 0 deletions integration_test/etc/config.dump.gold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ oidc:
- profile
- email
strip_email_domain: true
use_username_claim: false
use_expiry_from_token: false
private_key_path: private.key
noise:
Expand Down

0 comments on commit 5d72a5b

Please sign in to comment.