diff --git a/Dockerfile b/Dockerfile index dcefd2e..7a34d6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,6 @@ FROM alpine WORKDIR / COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ -COPY --from=builder /src/bin/neofs-send-authz /bin/neofs-send-authz +COPY --from=builder /src/bin/neofs-oauthz /bin/neofs-oauthz -ENTRYPOINT ["/bin/neofs-send-authz"] +ENTRYPOINT ["/bin/neofs-oauthz"] diff --git a/Makefile b/Makefile index 7302475..8fdc18c 100644 --- a/Makefile +++ b/Makefile @@ -3,7 +3,7 @@ REPO ?= $(shell go list -m) VERSION ?= $(shell git describe --tags --match "v*" --dirty --always) -HUB_IMAGE ?= nspccdev/neofs-send-authz +HUB_IMAGE ?= nspccdev/neofs-oauthz HUB_TAG ?= "$(shell echo ${VERSION} | sed 's/^v//')" # List of binaries to build. For now just one. @@ -40,7 +40,7 @@ dep: go mod tidy -v && echo OK image: - @echo "⇒ Build NeoFS Send Auth docker image " + @echo "⇒ Build NeoFS OAuthz docker image " @docker build \ --build-arg REPO=$(REPO) \ --build-arg VERSION=$(VERSION) \ diff --git a/README.md b/README.md index 20f6201..6868c40 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ -# neofs-send-authz -neofs-send-authz is backend which allows to login to NeoFS network via Google or Github OAuth 2.0. +# neofs-oauthz +neofs-oauthz is an authentication backend allowing to login to NeoFS network +via Google or Github OAuth 2.0. It checks the user and then generates a bearer +token to allow uploading files with user's e-mail specified in +attributes. There is no fancy key management there, but at the same time it +allows to identify each object's uploader which is the main purpose for it +now. This backend is currently used by https://send.fs.neo.org/ demo. ## Installation 1. To build the binary run the following command: @@ -12,13 +17,13 @@ make image ``` ## Execution -neofs-send-authz must be run with `.yaml` config file: +neofs-oauthz must be run with `.yaml` config file: ``` -$ ./neofs-send-authz -c config.yaml +$ ./neofs-oauthz -c config.yaml ``` or environment variables ``` -SEND_AUTHZ_CONFIG=config.yaml ./neofs-send-authz +NEOFS_OAUTHZ_CONFIG=config.yaml ./neofs-oauthz ``` ## Configuration diff --git a/auth/authenticator.go b/auth/authenticator.go index b09a367..67323a3 100644 --- a/auth/authenticator.go +++ b/auth/authenticator.go @@ -8,8 +8,8 @@ import ( "fmt" "net/http" + "github.com/nspcc-dev/neofs-oauthz/bearer" "github.com/nspcc-dev/neofs-sdk-go/pool" - "github.com/nspcc-dev/neofs-send-authz/bearer" "go.uber.org/zap" ) diff --git a/cmd/neofs-send-authz/app.go b/cmd/neofs-oauthz/app.go similarity index 98% rename from cmd/neofs-send-authz/app.go rename to cmd/neofs-oauthz/app.go index e959268..15afe85 100644 --- a/cmd/neofs-send-authz/app.go +++ b/cmd/neofs-oauthz/app.go @@ -11,11 +11,11 @@ import ( "github.com/nspcc-dev/neo-go/pkg/crypto/keys" "github.com/nspcc-dev/neo-go/pkg/util" "github.com/nspcc-dev/neo-go/pkg/wallet" + "github.com/nspcc-dev/neofs-oauthz/auth" + "github.com/nspcc-dev/neofs-oauthz/bearer" cid "github.com/nspcc-dev/neofs-sdk-go/container/id" "github.com/nspcc-dev/neofs-sdk-go/pool" "github.com/nspcc-dev/neofs-sdk-go/user" - "github.com/nspcc-dev/neofs-send-authz/auth" - "github.com/nspcc-dev/neofs-send-authz/bearer" "github.com/spf13/viper" "go.uber.org/zap" "golang.org/x/oauth2" diff --git a/cmd/neofs-send-authz/config.go b/cmd/neofs-oauthz/config.go similarity index 97% rename from cmd/neofs-send-authz/config.go rename to cmd/neofs-oauthz/config.go index c58174e..4670654 100644 --- a/cmd/neofs-send-authz/config.go +++ b/cmd/neofs-oauthz/config.go @@ -89,7 +89,7 @@ func newConfig() *viper.Viper { switch { case help != nil && *help: - fmt.Printf("NeoFS Send Authz %s\n", Version) + fmt.Printf("NeoFS OAuthz %s\n", Version) flags.PrintDefaults() fmt.Println() @@ -109,7 +109,7 @@ func newConfig() *viper.Viper { os.Exit(0) case version != nil && *version: - fmt.Printf("NeoFS Send Authz %s\n", Version) + fmt.Printf("NeoFS OAuthz %s\n", Version) os.Exit(0) } diff --git a/cmd/neofs-send-authz/main.go b/cmd/neofs-oauthz/main.go similarity index 100% rename from cmd/neofs-send-authz/main.go rename to cmd/neofs-oauthz/main.go diff --git a/cmd/neofs-send-authz/misc.go b/cmd/neofs-oauthz/misc.go similarity index 84% rename from cmd/neofs-send-authz/misc.go rename to cmd/neofs-oauthz/misc.go index 915f152..12cca43 100644 --- a/cmd/neofs-send-authz/misc.go +++ b/cmd/neofs-oauthz/misc.go @@ -2,7 +2,7 @@ package main // Prefix is a prefix used for environment variables containing authz // configuration. -const Prefix = "SEND_AUTHZ" +const Prefix = "NEOFS_OAUTHZ" var ( // Version is gateway version. diff --git a/go.mod b/go.mod index 6f0341f..1d99dab 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/nspcc-dev/neofs-send-authz +module github.com/nspcc-dev/neofs-oauthz go 1.18