Repository: apache/pulsar-client-go
Pull request #914 (2022-12-19 04:44:33)

Move out the auth package from internal
Fix https://github.com/apache/pulsar-client-go/issues/863

### Motivation

The auth package is internal, the developer cannot implement their auth provider, so we need to move out the auth package from internal.

### Modifications

Move out the auth package from `pulsar/internal/auth` to `pulsar/auth`.



Patch:
diff --git a/pulsar/internal/auth/basic.go b/pulsar/auth/basic.go
similarity index 100%
rename from pulsar/internal/auth/basic.go
rename to pulsar/auth/basic.go
diff --git a/pulsar/internal/auth/basic_test.go b/pulsar/auth/basic_test.go
similarity index 100%
rename from pulsar/internal/auth/basic_test.go
rename to pulsar/auth/basic_test.go
diff --git a/pulsar/internal/auth/disabled.go b/pulsar/auth/disabled.go
similarity index 100%
rename from pulsar/internal/auth/disabled.go
rename to pulsar/auth/disabled.go
diff --git a/pulsar/internal/auth/oauth2.go b/pulsar/auth/oauth2.go
similarity index 100%
rename from pulsar/internal/auth/oauth2.go
rename to pulsar/auth/oauth2.go
diff --git a/pulsar/internal/auth/oauth2_test.go b/pulsar/auth/oauth2_test.go
similarity index 100%
rename from pulsar/internal/auth/oauth2_test.go
rename to pulsar/auth/oauth2_test.go
diff --git a/pulsar/internal/auth/provider.go b/pulsar/auth/provider.go
similarity index 100%
rename from pulsar/internal/auth/provider.go
rename to pulsar/auth/provider.go
diff --git a/pulsar/internal/auth/tls.go b/pulsar/auth/tls.go
similarity index 100%
rename from pulsar/internal/auth/tls.go
rename to pulsar/auth/tls.go
diff --git a/pulsar/internal/auth/token.go b/pulsar/auth/token.go
similarity index 100%
rename from pulsar/internal/auth/token.go
rename to pulsar/auth/token.go
diff --git a/pulsar/client.go b/pulsar/client.go
index 29a582f..d75c977 100644
--- a/pulsar/client.go
+++ b/pulsar/client.go
@@ -21,7 +21,7 @@ import (
 	"crypto/tls"
 	"time"
 
-	"github.com/apache/pulsar-client-go/pulsar/internal/auth"
+	"github.com/apache/pulsar-client-go/pulsar/auth"
 	"github.com/apache/pulsar-client-go/pulsar/log"
 	"github.com/prometheus/client_golang/prometheus"
 )
diff --git a/pulsar/client_impl.go b/pulsar/client_impl.go
index 7cac097..e794e3d 100644
--- a/pulsar/client_impl.go
+++ b/pulsar/client_impl.go
@@ -22,12 +22,11 @@ import (
 	"net/url"
 	"time"
 
-	"github.com/prometheus/client_golang/prometheus"
-	"github.com/sirupsen/logrus"
-
+	"github.com/apache/pulsar-client-go/pulsar/auth"
 	"github.com/apache/pulsar-client-go/pulsar/internal"
-	"github.com/apache/pulsar-client-go/pulsar/internal/auth"
 	"github.com/apache/pulsar-client-go/pulsar/log"
+	"github.com/prometheus/client_golang/prometheus"
+	"github.com/sirupsen/logrus"
 )
 
 const (
diff --git a/pulsar/consumer.go b/pulsar/consumer.go
index 0a515e0..0e89fc0 100644
--- a/pulsar/consumer.go
+++ b/pulsar/consumer.go
@@ -267,9 +267,6 @@ type Consumer interface {
 
 	// SeekByTime resets the subscription associated with this consumer to a specific message publish time.
 	//
-	// Note: this operation can only be done on non-partitioned topics. For these, one can rather perform the seek() on
-	// the individual partitions.
-	//
 	// @param time
 	//            the message publish time when to reposition the subscription
 	//
diff --git a/pulsar/internal/connection.go b/pulsar/internal/connection.go
index 00a9521..be95240 100644
--- a/pulsar/internal/connection.go
+++ b/pulsar/internal/connection.go
@@ -29,9 +29,10 @@ import (
 	"sync/atomic"
 	"time"
 
+	"github.com/apache/pulsar-client-go/pulsar/auth"
+
 	"google.golang.org/protobuf/proto"
 
-	"github.com/apache/pulsar-client-go/pulsar/internal/auth"
 	pb "github.com/apache/pulsar-client-go/pulsar/internal/pulsar_proto"
 	"github.com/apache/pulsar-client-go/pulsar/log"
 
diff --git a/pulsar/internal/connection_pool.go b/pulsar/internal/connection_pool.go
index cb172a1..4f6d656 100644
--- a/pulsar/internal/connection_pool.go
+++ b/pulsar/internal/connection_pool.go
@@ -24,7 +24,8 @@ import (
 	"sync/atomic"
 	"time"
 
-	"github.com/apache/pulsar-client-go/pulsar/internal/auth"
+	"github.com/apache/pulsar-client-go/pulsar/auth"
+
 	"github.com/apache/pulsar-client-go/pulsar/log"
 )
 
diff --git a/pulsar/internal/http_client.go b/pulsar/internal/http_client.go
index 7abf70d..672a65e 100644
--- a/pulsar/internal/http_client.go
+++ b/pulsar/internal/http_client.go
@@ -29,7 +29,7 @@ import (
 	"path"
 	"time"
 
-	"github.com/apache/pulsar-client-go/pulsar/internal/auth"
+	"github.com/apache/pulsar-client-go/pulsar/auth"
 
 	"github.com/apache/pulsar-client-go/pulsar/log"
 


Test patch:
diff --git a/pulsar/internal/auth/athenz.go b/pulsar/auth/athenz.go
similarity index 100%
rename from pulsar/internal/auth/athenz.go
rename to pulsar/auth/athenz.go
diff --git a/pulsar/internal/auth/athenz_test.go b/pulsar/auth/athenz_test.go
similarity index 96%
rename from pulsar/internal/auth/athenz_test.go
rename to pulsar/auth/athenz_test.go
index 2556e93..97cc0ae 100644
--- a/pulsar/internal/auth/athenz_test.go
+++ b/pulsar/auth/athenz_test.go
@@ -27,10 +27,10 @@ import (
 	zms "github.com/AthenZ/athenz/libs/go/zmssvctoken"
 	zts "github.com/AthenZ/athenz/libs/go/ztsroletoken"
 	"github.com/stretchr/testify/assert"
-	mock "github.com/stretchr/testify/mock"
+	"github.com/stretchr/testify/mock"
 )
 
-const tlsClientKeyPath = "../../../integration-tests/certs/client-key.pem"
+const tlsClientKeyPath = "../../integration-tests/certs/client-key.pem"
 
 type MockTokenBuilder struct {
 	mock.Mock
diff --git a/pulsar/client_impl_test.go b/pulsar/client_impl_test.go
index c98a542..6ead057 100644
--- a/pulsar/client_impl_test.go
+++ b/pulsar/client_impl_test.go
@@ -28,12 +28,10 @@ import (
 	"testing"
 	"time"
 
-	"github.com/stretchr/testify/require"
-
+	"github.com/apache/pulsar-client-go/pulsar/auth"
 	"github.com/apache/pulsar-client-go/pulsar/internal"
-
-	"github.com/apache/pulsar-client-go/pulsar/internal/auth"
 	"github.com/stretchr/testify/assert"
+	"github.com/stretchr/testify/require"
 )
 
 func TestClient(t *testing.T) {