forked from TrueCloudLab/frostfs-s3-gw
Remove aliasing
This commit is contained in:
parent
3870f59484
commit
24b19152c4
4 changed files with 10 additions and 10 deletions
|
@ -4,11 +4,11 @@ import (
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
s3auth "github.com/minio/minio/auth"
|
"github.com/minio/minio/auth"
|
||||||
"go.uber.org/zap"
|
"go.uber.org/zap"
|
||||||
)
|
)
|
||||||
|
|
||||||
func attachNewUserAuth(router *mux.Router, center *s3auth.Center, log *zap.Logger) {
|
func attachNewUserAuth(router *mux.Router, center *auth.Center, log *zap.Logger) {
|
||||||
uamw := func(h http.Handler) http.Handler {
|
uamw := func(h http.Handler) http.Handler {
|
||||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||||
_, err := center.AuthenticationPassed(r)
|
_, err := center.AuthenticationPassed(r)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
s3auth "github.com/minio/minio/auth"
|
"github.com/minio/minio/auth"
|
||||||
"github.com/minio/minio/neofs/pool"
|
"github.com/minio/minio/neofs/pool"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ type empty int
|
||||||
|
|
||||||
func (empty) Read([]byte) (int, error) { return 0, io.EOF }
|
func (empty) Read([]byte) (int, error) { return 0, io.EOF }
|
||||||
|
|
||||||
func fetchAuthCenter(l *zap.Logger, v *viper.Viper) (*s3auth.Center, error) {
|
func fetchAuthCenter(l *zap.Logger, v *viper.Viper) (*auth.Center, error) {
|
||||||
var (
|
var (
|
||||||
err error
|
err error
|
||||||
neofsPrivateKey *ecdsa.PrivateKey
|
neofsPrivateKey *ecdsa.PrivateKey
|
||||||
|
@ -106,11 +106,11 @@ func fetchAuthCenter(l *zap.Logger, v *viper.Viper) (*s3auth.Center, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uapk := v.GetString(cfgUserAuthPrivateKey)
|
uapk := v.GetString(cfgUserAuthPrivateKey)
|
||||||
userAuthPrivateKey, err = s3auth.ReadRSAPrivateKeyFromPEMFile(uapk)
|
userAuthPrivateKey, err = auth.ReadRSAPrivateKeyFromPEMFile(uapk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "could not load UserAuth private key")
|
return nil, errors.Wrap(err, "could not load UserAuth private key")
|
||||||
}
|
}
|
||||||
center := s3auth.NewCenter(l)
|
center := auth.NewCenter(l)
|
||||||
center.SetUserAuthKeys(userAuthPrivateKey)
|
center.SetUserAuthKeys(userAuthPrivateKey)
|
||||||
center.SetNeoFSKeys(neofsPrivateKey)
|
center.SetNeoFSKeys(neofsPrivateKey)
|
||||||
return center, nil
|
return center, nil
|
||||||
|
|
|
@ -7,7 +7,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
s3auth "github.com/minio/minio/auth"
|
"github.com/minio/minio/auth"
|
||||||
minio "github.com/minio/minio/legacy"
|
minio "github.com/minio/minio/legacy"
|
||||||
"github.com/minio/minio/legacy/config"
|
"github.com/minio/minio/legacy/config"
|
||||||
"github.com/minio/minio/neofs/layer"
|
"github.com/minio/minio/neofs/layer"
|
||||||
|
@ -20,7 +20,7 @@ import (
|
||||||
|
|
||||||
type (
|
type (
|
||||||
App struct {
|
App struct {
|
||||||
center *s3auth.Center
|
center *auth.Center
|
||||||
cli pool.Pool
|
cli pool.Pool
|
||||||
log *zap.Logger
|
log *zap.Logger
|
||||||
cfg *viper.Viper
|
cfg *viper.Viper
|
||||||
|
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"math"
|
"math"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
s3auth "github.com/minio/minio/auth"
|
auth "github.com/minio/minio/auth"
|
||||||
minio "github.com/minio/minio/legacy"
|
minio "github.com/minio/minio/legacy"
|
||||||
"github.com/minio/minio/neofs/pool"
|
"github.com/minio/minio/neofs/pool"
|
||||||
"github.com/nspcc-dev/neofs-api-go/refs"
|
"github.com/nspcc-dev/neofs-api-go/refs"
|
||||||
|
@ -41,7 +41,7 @@ type (
|
||||||
|
|
||||||
// NewGatewayLayer creates instance of neofsObject. It checks credentials
|
// NewGatewayLayer creates instance of neofsObject. It checks credentials
|
||||||
// and establishes gRPC connection with node.
|
// and establishes gRPC connection with node.
|
||||||
func NewLayer(log *zap.Logger, cli pool.Client, center *s3auth.Center) (minio.ObjectLayer, error) {
|
func NewLayer(log *zap.Logger, cli pool.Client, center *auth.Center) (minio.ObjectLayer, error) {
|
||||||
// setup gRPC connection
|
// setup gRPC connection
|
||||||
// todo: think about getting timeout parameters from cli args
|
// todo: think about getting timeout parameters from cli args
|
||||||
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
|
||||||
|
|
Loading…
Reference in a new issue