Skip to content

Commit ae4fe6f

Browse files
committed
add sub field to more tests
1 parent 29314e4 commit ae4fe6f

File tree

3 files changed

+5
-0
lines changed

3 files changed

+5
-0
lines changed

coderd/oauthpki/okidcpki_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313

1414
"github.com/coreos/go-oidc/v3/oidc"
1515
"github.com/golang-jwt/jwt/v4"
16+
"github.com/google/uuid"
1617
"github.com/stretchr/testify/assert"
1718
"github.com/stretchr/testify/require"
1819
"golang.org/x/oauth2"
@@ -169,6 +170,7 @@ func TestAzureAKPKIWithCoderd(t *testing.T) {
169170
const email = "alice@coder.com"
170171
claims := jwt.MapClaims{
171172
"email": email,
173+
"sub": uuid.NewString(),
172174
}
173175
helper := oidctest.NewLoginHelper(owner, fake)
174176
user, _ := helper.Login(t, claims)

coderd/userauth_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ func TestOIDCOauthLoginWithExisting(t *testing.T) {
7272
"email": "alice@coder.com",
7373
"email_verified": true,
7474
"preferred_username": username,
75+
"sub": uuid.NewString(),
7576
}
7677

7778
helper := oidctest.NewLoginHelper(client, fake)
@@ -1828,6 +1829,7 @@ func TestOIDCSkipIssuer(t *testing.T) {
18281829
userClient, _ := fake.Login(t, owner, jwt.MapClaims{
18291830
"iss": secondaryURLString,
18301831
"email": "alice@coder.com",
1832+
"sub": uuid.NewString(),
18311833
})
18321834
found, err := userClient.User(ctx, "me")
18331835
require.NoError(t, err)

coderd/users_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -831,6 +831,7 @@ func TestPostUsers(t *testing.T) {
831831
// Try to log in with OIDC.
832832
userClient, _ := fake.Login(t, client, jwt.MapClaims{
833833
"email": email,
834+
"sub": uuid.NewString(),
834835
})
835836

836837
found, err := userClient.User(ctx, "me")

0 commit comments

Comments
 (0)