Skip to content

Commit b1b2287

Browse files
authored
chore: update go libs (#83)
1 parent 3930503 commit b1b2287

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+186
-195
lines changed

cmd/root.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"strings"
88

99
_ "github.com/bombsimon/logrusr/v3"
10-
"github.com/formancehq/go-libs/sharedotlp/pkg/sharedotlptraces"
10+
"github.com/formancehq/go-libs/otlp/otlptraces"
1111
"github.com/spf13/cobra"
1212
"github.com/spf13/viper"
1313
)
@@ -68,7 +68,7 @@ func rootCommand() *cobra.Command {
6868
server.Flags().Bool(authBearerUseScopesFlag,
6969
false, "Use scopes as defined by rfc https://datatracker.ietf.org/doc/html/rfc8693")
7070

71-
sharedotlptraces.InitOTLPTracesFlags(server.Flags())
71+
otlptraces.InitOTLPTracesFlags(server.Flags())
7272

7373
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_", "-", "_"))
7474
viper.AutomaticEnv()

cmd/server.go

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package cmd
33
import (
44
"strings"
55

6-
"github.com/formancehq/go-libs/sharedotlp/pkg/sharedotlptraces"
6+
"github.com/formancehq/go-libs/otlp/otlptraces"
77

88
"github.com/bombsimon/logrusr/v3"
99
"github.com/formancehq/payments/internal/app/api"
@@ -13,11 +13,11 @@ import (
1313

1414
"github.com/Shopify/sarama"
1515
"github.com/ThreeDotsLabs/watermill/message"
16-
"github.com/formancehq/go-libs/sharedlogging"
17-
"github.com/formancehq/go-libs/sharedlogging/sharedlogginglogrus"
18-
"github.com/formancehq/go-libs/sharedpublish"
19-
"github.com/formancehq/go-libs/sharedpublish/sharedpublishhttp"
20-
"github.com/formancehq/go-libs/sharedpublish/sharedpublishkafka"
16+
"github.com/formancehq/go-libs/logging"
17+
"github.com/formancehq/go-libs/logging/logginglogrus"
18+
"github.com/formancehq/go-libs/publish"
19+
"github.com/formancehq/go-libs/publish/publishhttp"
20+
"github.com/formancehq/go-libs/publish/publishkafka"
2121
"github.com/sirupsen/logrus"
2222
"github.com/spf13/cobra"
2323
"github.com/spf13/viper"
@@ -76,41 +76,41 @@ func runServer(cmd *cobra.Command, args []string) error {
7676
}
7777

7878
options = append(options, databaseOptions)
79-
options = append(options, sharedotlptraces.CLITracesModule(viper.GetViper()))
79+
options = append(options, otlptraces.CLITracesModule(viper.GetViper()))
8080

8181
options = append(options,
82-
fx.Provide(fx.Annotate(func(p message.Publisher) *sharedpublish.TopicMapperPublisher {
83-
return sharedpublish.NewTopicMapperPublisher(p, topicsMapping())
84-
}, fx.As(new(sharedpublish.Publisher)))))
82+
fx.Provide(fx.Annotate(func(p message.Publisher) *publish.TopicMapperPublisher {
83+
return publish.NewTopicMapperPublisher(p, topicsMapping())
84+
}, fx.As(new(publish.Publisher)))))
8585

8686
options = append(options, api.HTTPModule())
87-
options = append(options, sharedpublish.Module())
87+
options = append(options, publish.Module())
8888

8989
switch {
9090
case viper.GetBool(publisherHTTPEnabledFlag):
91-
options = append(options, sharedpublishhttp.Module())
91+
options = append(options, publishhttp.Module())
9292
case viper.GetBool(publisherKafkaEnabledFlag):
9393
options = append(options,
94-
sharedpublishkafka.Module(serviceName, viper.GetStringSlice(publisherKafkaBrokerFlag)...),
95-
sharedpublishkafka.ProvideSaramaOption(
96-
sharedpublishkafka.WithConsumerReturnErrors(),
97-
sharedpublishkafka.WithProducerReturnSuccess(),
94+
publishkafka.Module(serviceName, viper.GetStringSlice(publisherKafkaBrokerFlag)...),
95+
publishkafka.ProvideSaramaOption(
96+
publishkafka.WithConsumerReturnErrors(),
97+
publishkafka.WithProducerReturnSuccess(),
9898
),
9999
)
100100

101101
if viper.GetBool(publisherKafkaTLSEnabled) {
102-
options = append(options, sharedpublishkafka.ProvideSaramaOption(sharedpublishkafka.WithTLS()))
102+
options = append(options, publishkafka.ProvideSaramaOption(publishkafka.WithTLS()))
103103
}
104104

105105
if viper.GetBool(publisherKafkaSASLEnabled) {
106-
options = append(options, sharedpublishkafka.ProvideSaramaOption(
107-
sharedpublishkafka.WithSASLEnabled(),
108-
sharedpublishkafka.WithSASLCredentials(
106+
options = append(options, publishkafka.ProvideSaramaOption(
107+
publishkafka.WithSASLEnabled(),
108+
publishkafka.WithSASLCredentials(
109109
viper.GetString(publisherKafkaSASLUsername),
110110
viper.GetString(publisherKafkaSASLPassword),
111111
),
112-
sharedpublishkafka.WithSASLMechanism(sarama.SASLMechanism(viper.GetString(publisherKafkaSASLMechanism))),
113-
sharedpublishkafka.WithSASLScramClient(setSCRAMClient),
112+
publishkafka.WithSASLMechanism(sarama.SASLMechanism(viper.GetString(publisherKafkaSASLMechanism))),
113+
publishkafka.WithSASLScramClient(setSCRAMClient),
114114
))
115115
}
116116
}
@@ -142,7 +142,7 @@ func setLogger() {
142142
log.SetFormatter(&logrus.JSONFormatter{})
143143
}
144144

145-
sharedlogging.SetFactory(sharedlogging.StaticLoggerFactory(sharedlogginglogrus.New(log)))
145+
logging.SetFactory(logging.StaticLoggerFactory(logginglogrus.New(log)))
146146

147147
// Add a dedicated logger for opentelemetry in case of error
148148
otel.SetLogger(logrusr.New(logrus.New().WithField("component", "otlp")))
@@ -178,14 +178,14 @@ func setSCRAMClient() sarama.SCRAMClient {
178178

179179
switch viper.GetInt(publisherKafkaSASLScramSHASize) {
180180
case 512:
181-
fn = sharedpublishkafka.SHA512
181+
fn = publishkafka.SHA512
182182
case 256:
183-
fn = sharedpublishkafka.SHA256
183+
fn = publishkafka.SHA256
184184
default:
185185
panic("sha size not handled")
186186
}
187187

188-
return &sharedpublishkafka.XDGSCRAMClient{
188+
return &publishkafka.XDGSCRAMClient{
189189
HashGeneratorFcn: fn,
190190
}
191191
}

go.mod

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ require (
77
github.com/ThreeDotsLabs/watermill v1.1.1
88
github.com/bombsimon/logrusr/v3 v3.1.0
99
github.com/davecgh/go-spew v1.1.1
10-
github.com/formancehq/go-libs v1.3.0
11-
github.com/formancehq/go-libs/sharedapi v0.0.0-20221228150855-8e3cef21df97
12-
github.com/formancehq/go-libs/sharedotlp v0.0.0-20221228150855-8e3cef21df97
10+
github.com/formancehq/go-libs v1.4.1
1311
github.com/google/uuid v1.3.0
1412
github.com/gorilla/mux v1.8.0
1513
github.com/jackc/pgx/v5 v5.2.0
@@ -60,7 +58,7 @@ require (
6058
github.com/golang/glog v1.0.0 // indirect
6159
github.com/golang/protobuf v1.5.2 // indirect
6260
github.com/golang/snappy v0.0.4 // indirect
63-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 // indirect
61+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 // indirect
6462
github.com/hashicorp/errwrap v1.1.0 // indirect
6563
github.com/hashicorp/go-multierror v1.1.1 // indirect
6664
github.com/hashicorp/go-uuid v1.0.3 // indirect
@@ -115,7 +113,7 @@ require (
115113
golang.org/x/net v0.4.0 // indirect
116114
golang.org/x/sys v0.3.0 // indirect
117115
golang.org/x/text v0.5.0 // indirect
118-
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 // indirect
116+
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef // indirect
119117
google.golang.org/grpc v1.51.0 // indirect
120118
google.golang.org/protobuf v1.28.1 // indirect
121119
gopkg.in/ini.v1 v1.67.0 // indirect

go.sum

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,19 +107,13 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
107107
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
108108
github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk=
109109
github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
110-
github.com/formancehq/go-libs v1.3.0 h1:Ogs/B9FcoGHl2yF0TeTrBoGejKQk0G7XH6pFwgCod3U=
111-
github.com/formancehq/go-libs v1.3.0/go.mod h1:9pIcaXQR4O1biXDfhFurYJZw1piU6sJk+0Vqvu+92ng=
112-
github.com/formancehq/go-libs/sharedapi v0.0.0-20221228150855-8e3cef21df97 h1:9pP+VnP7C7dJpWuPlayPainZ01kqcIVu13nSf1wMVto=
113-
github.com/formancehq/go-libs/sharedapi v0.0.0-20221228150855-8e3cef21df97/go.mod h1:PMf25p7rXNJkc/LIwvf0AmGfAo1NqwQG+5emONMrurA=
114-
github.com/formancehq/go-libs/sharedotlp v0.0.0-20221228150855-8e3cef21df97 h1:png26T7Aot5+xNIoI29jo5VNA19rr/t0cGYR6NYW5qI=
115-
github.com/formancehq/go-libs/sharedotlp v0.0.0-20221228150855-8e3cef21df97/go.mod h1:sY3SY+G3EDNd9sELK6UbDYx3Ah+hJJsEnBU9Dq28ZSw=
110+
github.com/formancehq/go-libs v1.4.1 h1:rUKfUyZFq9aid+JUIqKN8Mk80Lx06Bx7AreHj+9vyTo=
111+
github.com/formancehq/go-libs v1.4.1/go.mod h1:IK1zDIGRPi/o8sSApIc1W0VC1Y0DGdADzxvpbqlD8fk=
116112
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
117113
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
118114
github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY=
119115
github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw=
120116
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
121-
github.com/gibson042/canonicaljson-go v1.0.3 h1:EAyF8L74AWabkyUmrvEFHEt/AGFQeD6RfwbAuf0j1bI=
122-
github.com/gibson042/canonicaljson-go v1.0.3/go.mod h1:DsLpJTThXyGNO+KZlI85C1/KDcImpP67k/RKVjcaEqo=
123117
github.com/go-chi/chi v4.0.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
124118
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
125119
github.com/go-chi/chi v4.1.2+incompatible/go.mod h1:eB3wogJHnLi3x/kFX2A+IbTBlXxmMeXJVKy9tTv1XzQ=
@@ -215,8 +209,8 @@ github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+
215209
github.com/gorilla/sessions v1.2.1/go.mod h1:dk2InVEVJ0sfLlnXv9EAgkf6ecYs/i80K/zI+bUmuGM=
216210
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
217211
github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks=
218-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0 h1:t7uX3JBHdVwAi3G7sSSdbsk8NfgA+LnUS88V/2EKaA0=
219-
github.com/grpc-ecosystem/grpc-gateway/v2 v2.14.0/go.mod h1:4OGVnY4qf2+gw+ssiHbW+pq4mo2yko94YxxMmXZ7jCA=
212+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0 h1:1JYBfzqrWPcCclBwxFCPAou9n+q86mfnu7NAeHfte7A=
213+
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.0/go.mod h1:YDZoGHuwE+ov0c8smSH49WLF3F2LaWnYYuDVd+EWrc0=
220214
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
221215
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
222216
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -298,7 +292,6 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v
298292
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
299293
github.com/pelletier/go-toml/v2 v2.0.6 h1:nrzqCb7j9cDFj2coyLNLaZuJTLjWjlaz6nvTvIwycIU=
300294
github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
301-
github.com/pierrec/lz4 v2.6.1+incompatible h1:9UY3+iC23yxF0UfGaYrGplQ+79Rg+h/q9FV9ix19jjM=
302295
github.com/pierrec/lz4/v4 v4.1.17 h1:kV4Ip+/hUBC+8T6+2EgburRtkE9ef4nbY3f4dFhGjMc=
303296
github.com/pierrec/lz4/v4 v4.1.17/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4=
304297
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
@@ -733,8 +726,8 @@ google.golang.org/genproto v0.0.0-20201214200347-8c77b98c765d/go.mod h1:FWY/as6D
733726
google.golang.org/genproto v0.0.0-20210108203827-ffc7fda8c3d7/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
734727
google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
735728
google.golang.org/genproto v0.0.0-20211118181313-81c1377c94b1/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
736-
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37 h1:jmIfw8+gSvXcZSgaFAGyInDXeWzUhvYH57G/5GKMn70=
737-
google.golang.org/genproto v0.0.0-20221207170731-23e4bf6bdc37/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
729+
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef h1:uQ2vjV/sHTsWSqdKeLqmwitzgvjMl7o4IdtHwUDXSJY=
730+
google.golang.org/genproto v0.0.0-20221227171554-f9683d7f8bef/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
738731
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
739732
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
740733
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=

internal/app/api/accounts.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/formancehq/payments/internal/app/models"
1111
"github.com/formancehq/payments/internal/app/storage"
1212

13-
"github.com/formancehq/go-libs/sharedapi"
13+
"github.com/formancehq/go-libs/api"
1414
"github.com/pkg/errors"
1515
)
1616

@@ -95,7 +95,7 @@ func listAccountsHandler(repo listAccountsRepository) http.HandlerFunc {
9595
}
9696
}
9797

98-
err = json.NewEncoder(w).Encode(sharedapi.BaseResponse[[]*accountResponse]{
98+
err = json.NewEncoder(w).Encode(api.BaseResponse[[]*accountResponse]{
9999
Data: &data,
100100
})
101101
if err != nil {

internal/app/api/connector.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ import (
1515

1616
"github.com/gorilla/mux"
1717

18-
"github.com/formancehq/go-libs/sharedapi"
19-
"github.com/formancehq/go-libs/sharedlogging"
18+
"github.com/formancehq/go-libs/api"
19+
"github.com/formancehq/go-libs/logging"
2020
"github.com/formancehq/payments/internal/app/integration"
2121
)
2222

2323
func handleErrorBadRequest(w http.ResponseWriter, r *http.Request, err error) {
2424
w.WriteHeader(http.StatusBadRequest)
2525

26-
sharedlogging.GetLogger(r.Context()).Error(err)
26+
logging.GetLogger(r.Context()).Error(err)
2727
// TODO: Opentracing
28-
err = json.NewEncoder(w).Encode(sharedapi.ErrorResponse{
28+
err = json.NewEncoder(w).Encode(api.ErrorResponse{
2929
ErrorCode: http.StatusText(http.StatusBadRequest),
3030
ErrorMessage: err.Error(),
3131
})
@@ -37,9 +37,9 @@ func handleErrorBadRequest(w http.ResponseWriter, r *http.Request, err error) {
3737
func handleError(w http.ResponseWriter, r *http.Request, err error) {
3838
w.WriteHeader(http.StatusInternalServerError)
3939

40-
sharedlogging.GetLogger(r.Context()).Error(err)
40+
logging.GetLogger(r.Context()).Error(err)
4141
// TODO: Opentracing
42-
err = json.NewEncoder(w).Encode(sharedapi.ErrorResponse{
42+
err = json.NewEncoder(w).Encode(api.ErrorResponse{
4343
ErrorCode: "INTERNAL",
4444
ErrorMessage: err.Error(),
4545
})

internal/app/api/connectormodule.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import (
1212

1313
"github.com/formancehq/payments/internal/app/storage"
1414

15-
"github.com/formancehq/go-libs/sharedlogging"
16-
"github.com/formancehq/go-libs/sharedpublish"
15+
"github.com/formancehq/go-libs/logging"
16+
"github.com/formancehq/go-libs/publish"
1717
"github.com/formancehq/payments/internal/app/ingestion"
1818
"github.com/formancehq/payments/internal/app/integration"
1919
"github.com/formancehq/payments/internal/app/task"
@@ -30,9 +30,9 @@ func addConnector[ConnectorConfig models.ConnectorConfigObject](loader integrati
3030
) fx.Option {
3131
return fx.Options(
3232
fx.Provide(func(store *storage.Storage,
33-
publisher sharedpublish.Publisher,
33+
publisher publish.Publisher,
3434
) *integration.ConnectorManager[ConnectorConfig] {
35-
logger := sharedlogging.GetLogger(context.Background())
35+
logger := logging.GetLogger(context.Background())
3636

3737
schedulerFactory := integration.TaskSchedulerFactoryFn(func(
3838
resolver task.Resolver, maxTasks int,

internal/app/api/module.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ import (
88
"strings"
99
"time"
1010

11-
"github.com/formancehq/go-libs/sharedapi"
12-
"github.com/formancehq/go-libs/sharedlogging"
11+
"github.com/formancehq/go-libs/api"
12+
"github.com/formancehq/go-libs/logging"
1313

1414
"github.com/formancehq/payments/internal/app/connectors/bankingcircle"
1515
"github.com/formancehq/payments/internal/app/connectors/currencycloud"
1616

17+
"github.com/formancehq/go-libs/auth"
1718
"github.com/formancehq/go-libs/oauth2/oauth2introspect"
18-
"github.com/formancehq/go-libs/sharedauth"
19-
sharedotlp "github.com/formancehq/go-libs/sharedotlp/pkg"
19+
"github.com/formancehq/go-libs/otlp"
2020
"github.com/formancehq/payments/internal/app/connectors/dummypay"
2121
"github.com/formancehq/payments/internal/app/connectors/modulr"
2222
"github.com/formancehq/payments/internal/app/connectors/stripe"
@@ -77,7 +77,7 @@ func HTTPModule() fx.Option {
7777

7878
func httpRecoveryFunc(ctx context.Context, e interface{}) {
7979
if viper.GetBool(otelTracesFlag) {
80-
sharedotlp.RecordAsError(ctx, e)
80+
otlp.RecordAsError(ctx, e)
8181
} else {
8282
logrus.Errorln(e)
8383
debug.PrintStack()
@@ -99,28 +99,28 @@ func httpServeFunc(handler http.Handler) http.Handler {
9999
})
100100
}
101101

102-
func sharedAuthMethods() []sharedauth.Method {
103-
methods := make([]sharedauth.Method, 0)
102+
func sharedAuthMethods() []auth.Method {
103+
methods := make([]auth.Method, 0)
104104

105105
if viper.GetBool(authBasicEnabledFlag) {
106-
credentials := sharedauth.Credentials{}
106+
credentials := auth.Credentials{}
107107

108108
for _, kv := range viper.GetStringSlice(authBasicCredentialsFlag) {
109109
parts := strings.SplitN(kv, ":", 2)
110-
credentials[parts[0]] = sharedauth.Credential{
110+
credentials[parts[0]] = auth.Credential{
111111
Password: parts[1],
112112
}
113113
}
114114

115-
methods = append(methods, sharedauth.NewHTTPBasicMethod(credentials))
115+
methods = append(methods, auth.NewHTTPBasicMethod(credentials))
116116
}
117117

118118
if viper.GetBool(authBearerEnabledFlag) {
119-
methods = append(methods, sharedauth.NewHttpBearerMethod(
120-
sharedauth.NewIntrospectionValidator(
119+
methods = append(methods, auth.NewHttpBearerMethod(
120+
auth.NewIntrospectionValidator(
121121
oauth2introspect.NewIntrospecter(viper.GetString(authBearerIntrospectURLFlag)),
122122
viper.GetBool(authBearerAudiencesWildcardFlag),
123-
sharedauth.AudienceIn(viper.GetStringSlice(authBearerAudienceFlag)...),
123+
auth.AudienceIn(viper.GetStringSlice(authBearerAudienceFlag)...),
124124
),
125125
))
126126
}
@@ -130,9 +130,9 @@ func sharedAuthMethods() []sharedauth.Method {
130130

131131
func handleServerError(w http.ResponseWriter, r *http.Request, err error) {
132132
w.WriteHeader(http.StatusInternalServerError)
133-
sharedlogging.GetLogger(r.Context()).Error(err)
133+
logging.GetLogger(r.Context()).Error(err)
134134
// TODO: Opentracing
135-
err = json.NewEncoder(w).Encode(sharedapi.ErrorResponse{
135+
err = json.NewEncoder(w).Encode(api.ErrorResponse{
136136
ErrorCode: "INTERNAL",
137137
ErrorMessage: err.Error(),
138138
})
@@ -143,9 +143,9 @@ func handleServerError(w http.ResponseWriter, r *http.Request, err error) {
143143

144144
func handleValidationError(w http.ResponseWriter, r *http.Request, err error) {
145145
w.WriteHeader(http.StatusBadRequest)
146-
sharedlogging.GetLogger(r.Context()).Error(err)
146+
logging.GetLogger(r.Context()).Error(err)
147147
// TODO: Opentracing
148-
err = json.NewEncoder(w).Encode(sharedapi.ErrorResponse{
148+
err = json.NewEncoder(w).Encode(api.ErrorResponse{
149149
ErrorCode: "VALIDATION",
150150
ErrorMessage: err.Error(),
151151
})

0 commit comments

Comments
 (0)