Skip to content

Commit cfbd168

Browse files
authored
fix(core): remove unused db argument (#653)
1 parent 96787fc commit cfbd168

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

service/internal/auth/authn.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import (
1717
"github.com/lestrrat-go/jwx/v2/jwk"
1818
"github.com/lestrrat-go/jwx/v2/jws"
1919
"github.com/lestrrat-go/jwx/v2/jwt"
20-
"github.com/opentdf/platform/service/internal/db"
2120
"google.golang.org/grpc"
2221
"google.golang.org/grpc/codes"
2322
"google.golang.org/grpc/metadata"
@@ -70,7 +69,7 @@ type Authentication struct {
7069
}
7170

7271
// Creates new authN which is used to verify tokens for a set of given issuers
73-
func NewAuthenticator(ctx context.Context, cfg Config, d *db.Client) (*Authentication, error) {
72+
func NewAuthenticator(ctx context.Context, cfg Config) (*Authentication, error) {
7473
a := &Authentication{
7574
enforceDPoP: cfg.EnforceDPoP,
7675
}
@@ -106,9 +105,6 @@ func NewAuthenticator(ctx context.Context, cfg Config, d *db.Client) (*Authentic
106105
casbinConfig := CasbinConfig{
107106
PolicyConfig: cfg.Policy,
108107
}
109-
if d != nil && d.SqlDB != nil {
110-
casbinConfig.DB = d.SqlDB
111-
}
112108
slog.Info("initializing casbin enforcer")
113109
if a.enforcer, err = NewCasbinEnforcer(casbinConfig); err != nil {
114110
return nil, fmt.Errorf("failed to initialize casbin enforcer: %w", err)

service/internal/auth/authn_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,7 @@ func (s *AuthSuite) SetupTest() {
149149
Audience: "test",
150150
},
151151
PublicRoutes: []string{"/public", "/public2/*", "/public3/static", "/static/*", "/static/*/*"},
152-
},
153-
nil)
152+
})
154153

155154
s.Require().NoError(err)
156155

@@ -554,7 +553,7 @@ func (s *AuthSuite) Test_Allowing_Auth_With_No_DPoP() {
554553
}
555554
config := Config{}
556555
config.AuthNConfig = authnConfig
557-
auth, err := NewAuthenticator(context.Background(), config, nil)
556+
auth, err := NewAuthenticator(context.Background(), config)
558557

559558
s.Require().NoError(err)
560559

service/internal/auth/casbin.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package auth
22

33
import (
4-
"database/sql"
54
"fmt"
65
"strings"
76

@@ -133,7 +132,6 @@ type casbinSubject struct {
133132

134133
type CasbinConfig struct {
135134
PolicyConfig
136-
DB *sql.DB
137135
}
138136

139137
// newCasbinEnforcer creates a new casbin enforcer

service/internal/server/server.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ func NewOpenTDFServer(config Config, d *db.Client) (*OpenTDFServer, error) {
9393
authN, err = auth.NewAuthenticator(
9494
context.Background(),
9595
config.Auth,
96-
d,
9796
)
9897
if err != nil {
9998
return nil, fmt.Errorf("failed to create authentication interceptor: %w", err)

0 commit comments

Comments
 (0)