Skip to content

Commit 117a405

Browse files
committed
typos
1 parent 07fd10d commit 117a405

File tree

2 files changed

+19
-24
lines changed

2 files changed

+19
-24
lines changed

coderd/externalauth/externalauth.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929

3030
// Config is used for authentication for Git operations.
3131
type Config struct {
32-
promoauth.InstrumentedeOAuth2Config
32+
promoauth.InstrumentedOAuth2Config
3333
// ID is a unique identifier for the authenticator.
3434
ID string
3535
// Type is the type of provider.
@@ -188,7 +188,7 @@ func (c *Config) ValidateToken(ctx context.Context, token string) (bool, *coders
188188
}
189189

190190
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
191-
res, err := c.InstrumentedeOAuth2Config.Do(ctx, "ValidateToken", req)
191+
res, err := c.InstrumentedOAuth2Config.Do(ctx, "ValidateToken", req)
192192
if err != nil {
193193
return false, nil, err
194194
}
@@ -238,7 +238,7 @@ func (c *Config) AppInstallations(ctx context.Context, token string) ([]codersdk
238238
return nil, false, err
239239
}
240240
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
241-
res, err := c.InstrumentedeOAuth2Config.Do(ctx, "AppInstallations", req)
241+
res, err := c.InstrumentedOAuth2Config.Do(ctx, "AppInstallations", req)
242242
if err != nil {
243243
return nil, false, err
244244
}
@@ -279,7 +279,7 @@ func (c *Config) AppInstallations(ctx context.Context, token string) ([]codersdk
279279

280280
type DeviceAuth struct {
281281
// Cfg is provided for the http client method.
282-
Cfg promoauth.InstrumentedeOAuth2Config
282+
Cfg promoauth.InstrumentedOAuth2Config
283283
ClientID string
284284
TokenURL string
285285
Scopes []string
@@ -456,17 +456,17 @@ func ConvertConfig(instrument *promoauth.Factory, entries []codersdk.ExternalAut
456456
}
457457

458458
cfg := &Config{
459-
InstrumentedeOAuth2Config: instrument.New(entry.ID, oauthConfig),
460-
ID: entry.ID,
461-
Regex: regex,
462-
Type: entry.Type,
463-
NoRefresh: entry.NoRefresh,
464-
ValidateURL: entry.ValidateURL,
465-
AppInstallationsURL: entry.AppInstallationsURL,
466-
AppInstallURL: entry.AppInstallURL,
467-
DisplayName: entry.DisplayName,
468-
DisplayIcon: entry.DisplayIcon,
469-
ExtraTokenKeys: entry.ExtraTokenKeys,
459+
InstrumentedOAuth2Config: instrument.New(entry.ID, oauthConfig),
460+
ID: entry.ID,
461+
Regex: regex,
462+
Type: entry.Type,
463+
NoRefresh: entry.NoRefresh,
464+
ValidateURL: entry.ValidateURL,
465+
AppInstallationsURL: entry.AppInstallationsURL,
466+
AppInstallURL: entry.AppInstallURL,
467+
DisplayName: entry.DisplayName,
468+
DisplayIcon: entry.DisplayIcon,
469+
ExtraTokenKeys: entry.ExtraTokenKeys,
470470
}
471471

472472
if entry.DeviceFlow {

coderd/promoauth/oauth2.go

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ type OAuth2Config interface {
1818
TokenSource(context.Context, *oauth2.Token) oauth2.TokenSource
1919
}
2020

21-
type InstrumentedeOAuth2Config interface {
21+
// InstrumentedOAuth2Config extends OAuth2Config with a `Do` method that allows
22+
// external oauth related calls to be instrumented. This is to support
23+
// "ValidateToken" which is not an oauth2 specified method.
24+
type InstrumentedOAuth2Config interface {
2225
OAuth2Config
2326

2427
// Do is provided as a convience method to make a request with the oauth2 client.
@@ -28,14 +31,6 @@ type InstrumentedeOAuth2Config interface {
2831
Do(ctx context.Context, source string, req *http.Request) (*http.Response, error)
2932
}
3033

31-
type HTTPDo interface {
32-
// Do is provided as a convience method to make a request with the oauth2 client.
33-
// It mirrors `http.Client.Do`.
34-
// We need this because Coder adds some extra functionality to
35-
// oauth clients such as the `ValidateToken()` method.
36-
Do(ctx context.Context, source string, req *http.Request) (*http.Response, error)
37-
}
38-
3934
var _ OAuth2Config = (*Config)(nil)
4035

4136
type Factory struct {

0 commit comments

Comments
 (0)