Skip to content

Commit 65b08c8

Browse files
committed
fix tests
1 parent 7f11ab7 commit 65b08c8

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

coderd/coderdtest/oidctest/idp.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -774,10 +774,16 @@ func (f *FakeIDP) OIDCCallback(t testing.TB, state string, idTokenClaims jwt.Map
774774
panic("cannot use OIDCCallback with WithServing. This is only for the in memory usage")
775775
}
776776

777+
opts := []oauth2.AuthCodeOption{}
778+
if f.pkce {
779+
verifier := oauth2.GenerateVerifier()
780+
opts = append(opts, oauth2.S256ChallengeOption(oauth2.S256ChallengeFromVerifier(verifier)))
781+
}
782+
777783
f.stateToIDTokenClaims.Store(state, idTokenClaims)
778784

779785
cli := f.HTTPClient(nil)
780-
u := f.locked.Config().AuthCodeURL(state)
786+
u := f.locked.Config().AuthCodeURL(state, opts...)
781787
req, err := http.NewRequest("GET", u, nil)
782788
require.NoError(t, err)
783789

coderd/externalauth/externalauth_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,7 @@ func TestConstantQueryParams(t *testing.T) {
729729
authURL.RawQuery = url.Values{constantQueryParamKey: []string{constantQueryParamValue}}.Encode()
730730
cfg.OAuth2Config.(*oauth2.Config).Endpoint.AuthURL = authURL.String()
731731
require.Contains(t, cfg.OAuth2Config.(*oauth2.Config).Endpoint.AuthURL, constantQueryParam)
732+
cfg.PKCEMethods = []promoauth.Oauth2PKCEChallengeMethod{promoauth.PKCEChallengeMethodSha256}
732733
},
733734
},
734735
})

0 commit comments

Comments
 (0)