Skip to content

Commit a2d3ab7

Browse files
authored
[chore] Revert "[extension/oauth2clientauthextension] Allow exporting of OAuth extension to re-use it in other components, required for #39248" (#39607)
Reverts #39514 as discussed as part of #39482.
1 parent ae276d9 commit a2d3ab7

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

extension/oauth2clientauthextension/extension.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ import (
2121
)
2222

2323
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)
2727
)
2828

29-
// OauthClientAuthenticator provides implementation for providing client authentication using OAuth2 client credentials
29+
// clientAuthenticator provides implementation for providing client authentication using OAuth2 client credentials
3030
// workflow for both gRPC and HTTP clients.
31-
type OauthClientAuthenticator struct {
31+
type clientAuthenticator struct {
3232
component.StartFunc
3333
component.ShutdownFunc
3434

@@ -48,7 +48,7 @@ var _ oauth2.TokenSource = (*errorWrappingTokenSource)(nil)
4848
// errFailedToGetSecurityToken indicates a problem communicating with OAuth2 server.
4949
var errFailedToGetSecurityToken = errors.New("failed to get security token from token endpoint")
5050

51-
func newClientAuthenticator(cfg *Config, logger *zap.Logger) (*OauthClientAuthenticator, error) {
51+
func newClientAuthenticator(cfg *Config, logger *zap.Logger) (*clientAuthenticator, error) {
5252
transport := http.DefaultTransport.(*http.Transport).Clone()
5353

5454
tlsCfg, err := cfg.TLSSetting.LoadTLSConfig(context.Background())
@@ -57,7 +57,7 @@ func newClientAuthenticator(cfg *Config, logger *zap.Logger) (*OauthClientAuthen
5757
}
5858
transport.TLSClientConfig = tlsCfg
5959

60-
return &OauthClientAuthenticator{
60+
return &clientAuthenticator{
6161
clientCredentials: &clientCredentialsConfig{
6262
Config: clientcredentials.Config{
6363
ClientID: cfg.ClientID,
@@ -90,7 +90,7 @@ func (ewts errorWrappingTokenSource) Token() (*oauth2.Token, error) {
9090

9191
// RoundTripper returns oauth2.Transport, an http.RoundTripper that performs "client-credential" OAuth flow and
9292
// 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) {
9494
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, o.client)
9595
return &oauth2.Transport{
9696
Source: errorWrappingTokenSource{
@@ -103,7 +103,7 @@ func (o *OauthClientAuthenticator) RoundTripper(base http.RoundTripper) (http.Ro
103103

104104
// PerRPCCredentials returns gRPC PerRPCCredentials that supports "client-credential" OAuth flow. The underneath
105105
// 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) {
107107
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, o.client)
108108
return grpcOAuth.TokenSource{
109109
TokenSource: errorWrappingTokenSource{

0 commit comments

Comments
 (0)