Skip to content

Commit

Permalink
authmate: Init authmate with layer.NeoFS interface
Browse files Browse the repository at this point in the history
Signed-off-by: Evgenii Baidakov <[email protected]>
  • Loading branch information
smallhive committed Aug 3, 2023
1 parent a19fd10 commit 518fd38
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 3 additions & 1 deletion cmd/s3-authmate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -706,5 +706,7 @@ func createNeoFS(ctx context.Context, log *zap.Logger, cfg PoolConfig) (authmate
return nil, fmt.Errorf("dial pool: %w", err)
}

return neofs.NewAuthmateNeoFS(p, signer), nil
neoFS := neofs.NewNeoFS(p, signer)

return neofs.NewAuthmateNeoFS(neoFS), nil
}
3 changes: 2 additions & 1 deletion cmd/s3-gw/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ func newApp(ctx context.Context, log *Logger, v *viper.Viper) *App {
conns, key, poolStat := getPool(ctx, log.logger, v)

signer := user.NewSignerRFC6979(key.PrivateKey)
neoFS := neofs.NewNeoFS(conns, signer)

// prepare auth center
ctr := auth.New(neofs.NewAuthmateNeoFS(conns, signer), key, v.GetStringSlice(cfgAllowedAccessKeyIDPrefixes), getAccessBoxCacheConfig(v, log.logger))
ctr := auth.New(neofs.NewAuthmateNeoFS(neoFS), key, v.GetStringSlice(cfgAllowedAccessKeyIDPrefixes), getAccessBoxCacheConfig(v, log.logger))

app := &App{
ctr: ctr,
Expand Down
6 changes: 3 additions & 3 deletions internal/neofs/neofs.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,12 @@ func (x *ResolverNeoFS) SystemDNS(ctx context.Context) (string, error) {

// AuthmateNeoFS is a mediator which implements authmate.NeoFS through pool.Pool.
type AuthmateNeoFS struct {
neoFS *NeoFS
neoFS layer.NeoFS
}

// NewAuthmateNeoFS creates new AuthmateNeoFS using provided pool.Pool.
func NewAuthmateNeoFS(p *pool.Pool, signer user.Signer) *AuthmateNeoFS {
return &AuthmateNeoFS{neoFS: NewNeoFS(p, signer)}
func NewAuthmateNeoFS(neoFS layer.NeoFS) *AuthmateNeoFS {
return &AuthmateNeoFS{neoFS: neoFS}

Check warning on line 450 in internal/neofs/neofs.go

View check run for this annotation

Codecov / codecov/patch

internal/neofs/neofs.go#L449-L450

Added lines #L449 - L450 were not covered by tests
}

// ContainerExists implements authmate.NeoFS interface method.
Expand Down

0 comments on commit 518fd38

Please sign in to comment.