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 11, 2023
1 parent f946239 commit 87362f9
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 @@ -91,9 +91,10 @@ func newApp(ctx context.Context, log *Logger, v *viper.Viper) *App {
conns, key, poolStat := getPool(ctx, log.logger, v)

signer := user.NewAutoIDSignerRFC6979(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 @@ -466,12 +466,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}
}

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

0 comments on commit 87362f9

Please sign in to comment.