Skip to content

Commit 192f9cd

Browse files
committed
feat: completely remove dependencies
1 parent b9724d0 commit 192f9cd

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

go.mod

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ require (
1212
github.com/spf13/cobra v1.7.0
1313
github.com/stretchr/testify v1.8.4
1414
github.com/tidwall/pretty v1.2.1
15-
gitlab.snapp.ir/security_regulatory/validator/pkg/sdk v0.2.2
1615
go.opentelemetry.io/otel v1.19.0
1716
go.opentelemetry.io/otel/exporters/jaeger v1.17.0
1817
go.opentelemetry.io/otel/sdk v1.19.0

go.sum

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
22
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
33
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
4-
github.com/agiledragon/gomonkey/v2 v2.10.1 h1:FPJJNykD1957cZlGhr9X0zjr291/lbazoZ/dmc4mS4c=
54
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
65
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
76
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
@@ -301,8 +300,6 @@ github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7Fw
301300
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
302301
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
303302
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
304-
gitlab.snapp.ir/security_regulatory/validator/pkg/sdk v0.2.2 h1:+JwjrfGwsdgojbfn26M4Af/ZzBHCsLyU9vNYWXe1HnM=
305-
gitlab.snapp.ir/security_regulatory/validator/pkg/sdk v0.2.2/go.mod h1:+0JXkekQpl5kJvmIKyBH5EJLIj0u628fbk+GfaIS+3k=
306303
go.etcd.io/etcd/api/v3 v3.5.4/go.mod h1:5GB2vv4A4AOn3yk7MftYGHkUfGtDHnEraIjym4dYz5A=
307304
go.etcd.io/etcd/client/pkg/v3 v3.5.4/go.mod h1:IJHfcCEKxYu1Os13ZdwCwIUTUVGYTSAM3YSwc9/Ac1g=
308305
go.etcd.io/etcd/client/v3 v3.5.4/go.mod h1:ZaRkVgBZC+L+dLCjTcF1hRXpgZXQPOvnA/Ak/gq3kiY=

internal/authenticator/auto_authenticator.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import (
1010
"github.com/snapp-incubator/soteria/internal/topics"
1111
"github.com/snapp-incubator/soteria/pkg/acl"
1212
"github.com/snapp-incubator/soteria/pkg/validator"
13-
validatorSDK "gitlab.snapp.ir/security_regulatory/validator/pkg/sdk"
1413
)
1514

1615
// AutoAuthenticator is responsible for Acl/Auth/Token of users.
@@ -19,14 +18,14 @@ type AutoAuthenticator struct {
1918
TopicManager *topics.Manager
2019
Company string
2120
JwtConfig config.Jwt
22-
Validator validatorSDK.Client
21+
Validator validator.Client
2322
Parser *jwt.Parser
2423
}
2524

2625
// Auth check user authentication by checking the user's token
2726
// isSuperuser is a flag that authenticator set it true when credentials is related to a superuser.
2827
func (a AutoAuthenticator) Auth(tokenString string) error {
29-
if _, err := a.Validator.Validate(context.Background(), &http.Header{
28+
if _, err := a.Validator.Validate(context.Background(), http.Header{
3029
validator.ServiceNameHeader: []string{"soteria"},
3130
"user-agent": []string{},
3231
"X-APP-Version-Code": []string{""},

internal/authenticator/builder.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/snapp-incubator/soteria/internal/config"
88
"github.com/snapp-incubator/soteria/internal/topics"
99
"github.com/snapp-incubator/soteria/pkg/acl"
10-
validatorSDK "gitlab.snapp.ir/security_regulatory/validator/pkg/sdk"
10+
"github.com/snapp-incubator/soteria/pkg/validator"
1111
"go.uber.org/zap"
1212
)
1313

@@ -30,7 +30,7 @@ func (b Builder) Authenticators() map[string]Authenticator {
3030
b.Logger.Fatal("cannot create hash-id manager", zap.Error(err))
3131
}
3232

33-
validatorClient := validatorSDK.New(b.ValidatorConfig.URL, b.ValidatorConfig.Timeout)
33+
client := validator.New(b.ValidatorConfig.URL, b.ValidatorConfig.Timeout)
3434

3535
var auth Authenticator
3636

@@ -47,7 +47,7 @@ func (b Builder) Authenticators() map[string]Authenticator {
4747
b.Logger.Named("topic-manager"),
4848
),
4949
JwtConfig: vendor.Jwt,
50-
Validator: validatorClient,
50+
Validator: client,
5151
Parser: jwt.NewParser(),
5252
}
5353
} else {

0 commit comments

Comments
 (0)