@@ -21,14 +21,14 @@ import (
21
21
)
22
22
23
23
var (
24
- _ extension.Extension = (* OauthClientAuthenticator )(nil )
25
- _ extensionauth.HTTPClient = (* OauthClientAuthenticator )(nil )
26
- _ extensionauth.GRPCClient = (* OauthClientAuthenticator )(nil )
24
+ _ extension.Extension = (* clientAuthenticator )(nil )
25
+ _ extensionauth.HTTPClient = (* clientAuthenticator )(nil )
26
+ _ extensionauth.GRPCClient = (* clientAuthenticator )(nil )
27
27
)
28
28
29
- // OauthClientAuthenticator provides implementation for providing client authentication using OAuth2 client credentials
29
+ // clientAuthenticator provides implementation for providing client authentication using OAuth2 client credentials
30
30
// workflow for both gRPC and HTTP clients.
31
- type OauthClientAuthenticator struct {
31
+ type clientAuthenticator struct {
32
32
component.StartFunc
33
33
component.ShutdownFunc
34
34
@@ -48,7 +48,7 @@ var _ oauth2.TokenSource = (*errorWrappingTokenSource)(nil)
48
48
// errFailedToGetSecurityToken indicates a problem communicating with OAuth2 server.
49
49
var errFailedToGetSecurityToken = errors .New ("failed to get security token from token endpoint" )
50
50
51
- func newClientAuthenticator (cfg * Config , logger * zap.Logger ) (* OauthClientAuthenticator , error ) {
51
+ func newClientAuthenticator (cfg * Config , logger * zap.Logger ) (* clientAuthenticator , error ) {
52
52
transport := http .DefaultTransport .(* http.Transport ).Clone ()
53
53
54
54
tlsCfg , err := cfg .TLSSetting .LoadTLSConfig (context .Background ())
@@ -57,7 +57,7 @@ func newClientAuthenticator(cfg *Config, logger *zap.Logger) (*OauthClientAuthen
57
57
}
58
58
transport .TLSClientConfig = tlsCfg
59
59
60
- return & OauthClientAuthenticator {
60
+ return & clientAuthenticator {
61
61
clientCredentials : & clientCredentialsConfig {
62
62
Config : clientcredentials.Config {
63
63
ClientID : cfg .ClientID ,
@@ -90,7 +90,7 @@ func (ewts errorWrappingTokenSource) Token() (*oauth2.Token, error) {
90
90
91
91
// RoundTripper returns oauth2.Transport, an http.RoundTripper that performs "client-credential" OAuth flow and
92
92
// also auto refreshes OAuth tokens as needed.
93
- func (o * OauthClientAuthenticator ) RoundTripper (base http.RoundTripper ) (http.RoundTripper , error ) {
93
+ func (o * clientAuthenticator ) RoundTripper (base http.RoundTripper ) (http.RoundTripper , error ) {
94
94
ctx := context .WithValue (context .Background (), oauth2 .HTTPClient , o .client )
95
95
return & oauth2.Transport {
96
96
Source : errorWrappingTokenSource {
@@ -103,7 +103,7 @@ func (o *OauthClientAuthenticator) RoundTripper(base http.RoundTripper) (http.Ro
103
103
104
104
// PerRPCCredentials returns gRPC PerRPCCredentials that supports "client-credential" OAuth flow. The underneath
105
105
// oauth2.clientcredentials.Config instance will manage tokens performing auto refresh as necessary.
106
- func (o * OauthClientAuthenticator ) PerRPCCredentials () (credentials.PerRPCCredentials , error ) {
106
+ func (o * clientAuthenticator ) PerRPCCredentials () (credentials.PerRPCCredentials , error ) {
107
107
ctx := context .WithValue (context .Background (), oauth2 .HTTPClient , o .client )
108
108
return grpcOAuth.TokenSource {
109
109
TokenSource : errorWrappingTokenSource {
0 commit comments