Skip to content

Commit 72cf509

Browse files
committed
WithRefreshHook -> WithRefresh
1 parent 399f91f commit 72cf509

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

coderd/coderdtest/oidctest/idp.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ func WithAuthorizedRedirectURL(hook func(redirectURL string) error) func(*FakeID
104104
}
105105
}
106106

107-
// WithRefreshHook is called when a refresh token is used. The email is
107+
// WithRefresh is called when a refresh token is used. The email is
108108
// the email of the user that is being refreshed assuming the claims are correct.
109-
func WithRefreshHook(hook func(email string) error) func(*FakeIDP) {
109+
func WithRefresh(hook func(email string) error) func(*FakeIDP) {
110110
return func(f *FakeIDP) {
111111
f.hookOnRefresh = hook
112112
}

coderd/gitauth/config_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func TestRefreshToken(t *testing.T) {
3333
t.Parallel()
3434
fake, config, link := setupOauth2Test(t, testConfig{
3535
FakeIDPOpts: []oidctest.FakeIDPOpt{
36-
oidctest.WithRefreshHook(func(_ string) error {
36+
oidctest.WithRefresh(func(_ string) error {
3737
t.Error("refresh on the IDP was called, but NoRefresh was set")
3838
return xerrors.New("should not be called")
3939
}),
@@ -66,7 +66,7 @@ func TestRefreshToken(t *testing.T) {
6666
validated := false
6767
fake, config, link := setupOauth2Test(t, testConfig{
6868
FakeIDPOpts: []oidctest.FakeIDPOpt{
69-
oidctest.WithRefreshHook(func(_ string) error {
69+
oidctest.WithRefresh(func(_ string) error {
7070
t.Error("refresh on the IDP was called, but NoRefresh was set")
7171
return xerrors.New("should not be called")
7272
}),
@@ -163,7 +163,7 @@ func TestRefreshToken(t *testing.T) {
163163
validateCalls := 0
164164
fake, config, link := setupOauth2Test(t, testConfig{
165165
FakeIDPOpts: []oidctest.FakeIDPOpt{
166-
oidctest.WithRefreshHook(func(_ string) error {
166+
oidctest.WithRefresh(func(_ string) error {
167167
t.Error("refresh on the IDP was called, but the token is not expired")
168168
return xerrors.New("should not be called")
169169
}),
@@ -197,7 +197,7 @@ func TestRefreshToken(t *testing.T) {
197197
validateCalls := 0
198198
fake, config, link := setupOauth2Test(t, testConfig{
199199
FakeIDPOpts: []oidctest.FakeIDPOpt{
200-
oidctest.WithRefreshHook(func(_ string) error {
200+
oidctest.WithRefresh(func(_ string) error {
201201
t.Error("refresh on the IDP was called, but the token is not expired")
202202
return xerrors.New("should not be called")
203203
}),
@@ -228,7 +228,7 @@ func TestRefreshToken(t *testing.T) {
228228
refreshCalls := 0
229229
fake, config, link := setupOauth2Test(t, testConfig{
230230
FakeIDPOpts: []oidctest.FakeIDPOpt{
231-
oidctest.WithRefreshHook(func(_ string) error {
231+
oidctest.WithRefresh(func(_ string) error {
232232
refreshCalls++
233233
return nil
234234
}),

coderd/userauth_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func TestOIDCOauthLoginWithExisting(t *testing.T) {
3737
t.Parallel()
3838

3939
fake := oidctest.NewFakeIDP(t,
40-
oidctest.WithRefreshHook(func(_ string) error {
40+
oidctest.WithRefresh(func(_ string) error {
4141
return xerrors.New("refreshing token should never occur")
4242
}),
4343
oidctest.WithServing(),
@@ -797,7 +797,7 @@ func TestUserOIDC(t *testing.T) {
797797
t.Run(tc.Name, func(t *testing.T) {
798798
t.Parallel()
799799
fake := oidctest.NewFakeIDP(t,
800-
oidctest.WithRefreshHook(func(_ string) error {
800+
oidctest.WithRefresh(func(_ string) error {
801801
return xerrors.New("refreshing token should never occur")
802802
}),
803803
oidctest.WithServing(),
@@ -851,7 +851,7 @@ func TestUserOIDC(t *testing.T) {
851851

852852
auditor := audit.NewMock()
853853
fake := oidctest.NewFakeIDP(t,
854-
oidctest.WithRefreshHook(func(_ string) error {
854+
oidctest.WithRefresh(func(_ string) error {
855855
return xerrors.New("refreshing token should never occur")
856856
}),
857857
oidctest.WithServing(),
@@ -898,7 +898,7 @@ func TestUserOIDC(t *testing.T) {
898898
t.Parallel()
899899
auditor := audit.NewMock()
900900
fake := oidctest.NewFakeIDP(t,
901-
oidctest.WithRefreshHook(func(_ string) error {
901+
oidctest.WithRefresh(func(_ string) error {
902902
return xerrors.New("refreshing token should never occur")
903903
}),
904904
oidctest.WithServing(),
@@ -959,7 +959,7 @@ func TestUserOIDC(t *testing.T) {
959959
t.Run("NoIDToken", func(t *testing.T) {
960960
t.Parallel()
961961
fake := oidctest.NewFakeIDP(t,
962-
oidctest.WithRefreshHook(func(_ string) error {
962+
oidctest.WithRefresh(func(_ string) error {
963963
return xerrors.New("refreshing token should never occur")
964964
}),
965965
oidctest.WithServing(),
@@ -984,7 +984,7 @@ func TestUserOIDC(t *testing.T) {
984984
badProvider := &oidc.Provider{}
985985

986986
fake := oidctest.NewFakeIDP(t,
987-
oidctest.WithRefreshHook(func(_ string) error {
987+
oidctest.WithRefresh(func(_ string) error {
988988
return xerrors.New("refreshing token should never occur")
989989
}),
990990
oidctest.WithServing(),

enterprise/coderd/userauth_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ func TestUserOIDC(t *testing.T) {
365365

366366
runner := setupOIDCTest(t, oidcTestConfig{
367367
FakeOpts: []oidctest.FakeIDPOpt{
368-
oidctest.WithRefreshHook(func(_ string) error {
368+
oidctest.WithRefresh(func(_ string) error {
369369
// Always "expired" refresh token.
370370
return xerrors.New("refresh token is expired")
371371
}),

0 commit comments

Comments
 (0)