Commit graph

740 commits

Author SHA1 Message Date
Denis Kirillov
6a135a6bb4 [#82] Using bearer token
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-06-15 17:16:26 +03:00
Denis Kirillov
fba29a9a66 [#78] Using client.Object from sdk
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-06-15 17:06:19 +03:00
Roman Khimov
ee078eabcc Merge pull request #80 from masterSplinter01/feature/48-protobuf-format-authbox
Protobuf format of accessbox
2021-06-15 16:57:22 +03:00
Angira Kekteeva
fe2d507121 [#48] creds,authmate:Replace old accessbox by new
Removed encoder, decoder wraps.
Made changes in api, authmate and creds via new accessbox.
Updated bearer_token_tests via new accessbox.

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-06-15 14:54:11 +03:00
Denis Kirillov
47fc10a869 [#65] Using containerList falls back
Looking container up using the owner list if its name is not cid

Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-06-13 14:32:13 +03:00
Denis Kirillov
4df647baac [#65] Added NoAuthorizationHeader error
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-06-11 19:29:55 +03:00
Denis Kirillov
8185b71462 [#65] Allow no sign requests
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
2021-06-11 14:52:03 +03:00
Angira Kekteeva
b3b190adc0 [#68] *: Replace deprecated
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-06-04 16:01:42 +03:00
Angira Kekteeva
1a818bac33 [#64] authmate, auth: Fix access key id
Replaced forbidden symbol '/' in access key id by '_'
SecretKeyAddress and SecretKeyID are different things now
Renamed param of authmate from secretAddressFlag to accessKeyIDFlag,
that is more correct, imo.

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-06-03 22:24:02 +03:00
Roman Khimov
d15687f37c *: drop creds/neofs
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-28 23:48:39 +03:00
Roman Khimov
35ffc1fbc1 *: use sdk-go instead of http-gw
Now that the packages have moved there we can do it.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-28 14:05:46 +03:00
Roman Khimov
1c277bd97b api: fix golint suggestion for proper context usage
api/user-auth.go:27:5  golint  should not use basic type string as key in context.WithValue

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-26 21:25:37 +03:00
Roman Khimov
184c26551a *: fix comments for golint
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-26 21:23:48 +03:00
Roman Khimov
d19ce03072 *: drop old sdk dependecies, bump neofs-api-go version
I'm not sure it works, but it's enough code-wise for now. We're reusing some
http-gw components here that are to be moved into sdk-go in future.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-26 21:01:46 +03:00
Roman Khimov
dbe65ae602 creds: move credential management into s3 gate
Mostly taken from old SDK (abe47687cd11266f946cad57f07572cc10c67226), but
error handling adapted to eliminate pkg/errors and internal packages.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-25 23:00:19 +03:00
Roman Khimov
ce7c8932d4 authmate: drop creds/s3 dependency
Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-25 19:52:51 +03:00
Roman Khimov
92c8cce933 misc: move to internal/version, use for all binaries
No libmisc, please.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-20 16:26:41 +03:00
Roman Khimov
ef8684c11d s3-gw: drop build time setting
It's not properly set anyway and it's a bad practice for build
reproducibility.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
2021-05-20 16:26:20 +03:00
Angira Kekteeva
9d496d70a7 [#53] *: Remove external pkg/errors dependency
Replaced functions from pkg/errors by functions from errors, fixed not fully correct comment

Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-05-20 15:50:14 +03:00
Angira Kekteeva
a399590204 Replace s3-gate by s3-gw
Signed-off-by: Angira Kekteeva <kira@nspcc.ru>
2021-05-18 14:12:24 +03:00
Roman Khimov
5eb863dc22 *: fix golint warnings about comments to exported things. 2021-05-13 23:25:31 +03:00
Roman Khimov
70a70bfa2c *: fix all godot errors 2021-05-13 22:25:32 +03:00
Roman Khimov
a0ecb8ff52 handler: suppress exhaustive linter 2021-05-13 22:15:21 +03:00
Roman Khimov
b851889934 *: fix whitespace errors 2021-05-13 22:13:09 +03:00
Evgeniy Kulikov
8467a07c9b Update dependencies and fixes
- Closes #39
- Cleanup code
- Make code more readable
- Update dependencies
	- github.com/aws/aws-sdk-go v1.37.1
	- github.com/google/uuid v1.2.0
	- github.com/nspcc-dev/cdn-sdk v0.3.3
	- github.com/nspcc-dev/neofs-api-go v1.22.2

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2021-02-01 19:59:42 +03:00
Evgeniy Kulikov
2a93a216f8 Migrate to SDK 0.3.0 and fixes
- fix displaying list objects
- simplify `ListObjects`
- simplify `GetObjectHandler`
- simplify `HeadObjectHandler`
- add method for `GetBucketVersioningHandler`
- add method for `ListMultipartUploadsHandler`
- improvements for `HeadObjectHandler`, to display folders meta
- update dependencies
  - github.com/aws/aws-sdk-go v1.36.26
  - github.com/google/uuid v1.1.4
  - github.com/gorilla/mux v1.8.0
  - github.com/nspcc-dev/cdn-sdk v0.3.0
  - github.com/nspcc-dev/neofs-api-go v1.22.0
  - github.com/prometheus/client_golang v1.9.0
  - github.com/stretchr/testify v1.7.0
  - google.golang.org/grpc v1.35.0

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2021-01-14 20:39:48 +03:00
Evgeniy Kulikov
8ff289ea4f Simplify OffsetWriter
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-12-10 18:15:43 +03:00
Evgeniy Kulikov
8168181658 Remove bufio writer and double creation of OffsetWriter
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-12-10 18:15:18 +03:00
Evgeniy Kulikov
776eed76fb Add writer detector
WriterDetector allows to fetch ContentType and write status response, when streaming content

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-12-10 18:14:32 +03:00
Evgeniy Kulikov
ef0e179b33 Fixes over bucket router
should work over {bucket}.{domain} and /{bucket}

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-12-10 18:13:28 +03:00
Evgeniy Kulikov
5752f2f89f Add method to fetch SecretAccessKey from BearerToken
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-27 16:33:56 +03:00
Evgeniy Kulikov
f4263d50a7 Refactoring api/layer
- don't require token.BearerToken
- simplify method layer.objectPut
- add method to check that object exists
- add method to fetch Owner (from context or sdk client)

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-27 15:36:15 +03:00
Evgeniy Kulikov
31d3e55489 Add content detector
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-27 15:33:31 +03:00
Evgeniy Kulikov
1868034723 Refactoring api/handler
- don't require token.BearerToken
- don't call `GetObjectInfo`

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-27 15:32:52 +03:00
Evgeniy Kulikov
58b877b97c Refactoring auth.Center
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-27 15:31:39 +03:00
Evgeniy Kulikov
697d318a6b WriteHeader should be called once
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-27 15:28:27 +03:00
Evgeniy Kulikov
1cd636a24b Refactoring api/auth package
Migrate to cred/bearer instead of CredentialsClient

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-24 19:31:57 +03:00
Evgeniy Kulikov
0284bf136b Migrate to Credentials client
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-24 12:17:36 +03:00
Evgeniy Kulikov
29cb755d49 Fixes of usage auth package
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-24 10:02:10 +03:00
Evgeniy Kulikov
0ee3a5f9ba Migrate api/layer to SDK
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-24 10:01:38 +03:00
Evgeniy Kulikov
e3b1e8f369 Fixes of usage auth package
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-24 10:00:49 +03:00
Evgeniy Kulikov
1fecf6a7ac Remove pool package
It will be replaced with sdk/pool

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-24 09:59:32 +03:00
Evgeniy Kulikov
b9972042fc Refactoring auth package and move into API
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-24 09:59:01 +03:00
Evgeniy Kulikov
54414c2bfb Fix NPE when response isn't http.Flusher
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-11-19 16:01:52 +03:00
Evgeniy Kulikov
256850b8fe [#25] Refactoring and make fixes
closes #25
closes #33

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-24 16:09:22 +03:00
Evgeniy Kulikov
4d605d1113 [#25] Refactoring and make fixes
closes #25
closes #32

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-23 03:21:14 +03:00
Evgeniy Kulikov
fbd4a83602 [#25] Refactoring over api/layer
closes #25

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-22 03:19:16 +03:00
Evgeniy Kulikov
b72a957341 [#25] Migrate handler to NeoFS API v2
Naive migration, without any tries to start application

closes #25

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-19 04:05:08 +03:00
Evgeniy Kulikov
7deeb68d47 [#25] Migrate layer to NeoFS API v2
Naive migration, without any tries to start application

closes #25

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-19 04:04:37 +03:00
Evgeniy Kulikov
86e07c8882 [#25] Fix linter warnings
closes #25

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-13 12:43:24 +03:00
Evgeniy Kulikov
b346a77933 [#25] Migrate connection pool to NeoFS API v2
closes #25

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-10-13 12:32:23 +03:00
Evgeniy Kulikov
8c93dbf867 [#29] Implement ListObjectsV2
ListObjectsV1 and ListObjectsV2 now simplified and return different results

closes #29

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:49:00 +03:00
Evgeniy Kulikov
079e7a9827 [#28] Implement HeadBucket
closes #28

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:45:48 +03:00
Evgeniy Kulikov
fd2c6e372b [#26] Implement DeleteMultipleObjects
closes #26

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:45:15 +03:00
Evgeniy Kulikov
cfe2811efc Add owner field for ListObjects method
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:43:53 +03:00
Evgeniy Kulikov
3244f54022 Change returned error for GetBucketInfo method
method should returns gRPC status errors

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:43:06 +03:00
Evgeniy Kulikov
8eff7d4dd3 Refactoring DeleteObject/DeleteObjects methods
- methods should return api.DeleteErrors
- DeleteObjects should return only slice of errors
- don't add nil errors

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:42:27 +03:00
Evgeniy Kulikov
960aa02bd3 Refactoring DeleteObject/DeleteObjects methods
- methods should return api.DeleteErrors
- DeleteObjects should return only slice of errors
- don't add nil errors

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:41:58 +03:00
Evgeniy Kulikov
5eae2aac78 Change NotFound error for objectFindID
method should return gRPC status error

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:39:12 +03:00
Evgeniy Kulikov
5258342881 Add Owner field into layer.ObjectInfo
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:37:39 +03:00
Evgeniy Kulikov
d2d54cbdaa Refactoring getAPIErrorResponse method
should receive base error type instead of custom errors

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:36:53 +03:00
Evgeniy Kulikov
0b533e189e Add custom http headers constants
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:35:32 +03:00
Evgeniy Kulikov
f3b202700e Refactoring WriteErrorResponse method
- should receive error instead custom type
- change visibility of WriteResponse method

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:34:50 +03:00
Evgeniy Kulikov
cd2cca8fb3 Change MimeTypes constants visibility
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-22 05:32:48 +03:00
Evgeniy Kulikov
0bea843d90 Fix DeleteObject handler
DeleteObject should remove all objects with passed nice name

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 22:41:52 +03:00
Evgeniy Kulikov
34f6eb7d55 Add note about multiple delete of objects
Could not find how to use it.
I propose open issue and describe how to use it and then implement method.

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 22:35:39 +03:00
Evgeniy Kulikov
21591ebe65 Add method to find all ID's for the nice names
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 22:33:59 +03:00
Evgeniy Kulikov
5bb2c34052 Cleanup unimplemented handlers
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:37:06 +03:00
Evgeniy Kulikov
1d98c4ecc2 Implement GetObject handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:36:46 +03:00
Evgeniy Kulikov
bfc4b8786f Implement HeadObject handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:36:34 +03:00
Evgeniy Kulikov
9493f3d281 Implement PutObject handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:36:17 +03:00
Evgeniy Kulikov
9746978b1d Implement DeleteObject handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:36:00 +03:00
Evgeniy Kulikov
9ab0571d29 Implement CopyObject handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:35:51 +03:00
Evgeniy Kulikov
c6d4b6d731 Implement MarshalXML for StringMap type
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:34:47 +03:00
Evgeniy Kulikov
fb13d1fcb3 Move ListObjects and ListBuckets in same file
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:33:43 +03:00
Evgeniy Kulikov
edd44ea981 Check that aws filename wasn't set
we should check that filename header wasn't set, otherwise we should not change custom filename

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:32:42 +03:00
Evgeniy Kulikov
00a17d8316 CopyObject should contains custom headers
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:31:04 +03:00
Evgeniy Kulikov
fb00af23fb Fixed possible NPE in PutObject
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:30:18 +03:00
Evgeniy Kulikov
447a255d18 Add func to debug requests
- logging middleware
- response writer with status code

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:28:16 +03:00
Evgeniy Kulikov
5df041f7d7 Add func to write headers only
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-20 02:27:13 +03:00
Evgeniy Kulikov
cea8f9d4ca Add bucket info handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-19 14:53:17 +03:00
Evgeniy Kulikov
92b039fa5e Add unsupported handlers
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-19 14:52:44 +03:00
Evgeniy Kulikov
b14e2d54c8 Prepare list-objects handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-11 17:37:20 +03:00
Evgeniy Kulikov
ccd481e4e2 Prepare list-buckets handler
Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-11 17:36:52 +03:00
Evgeniy Kulikov
d9f691a59a Refactoring API handlers
- add responses for list-objects and list-buckets
- set `implement me` errors more useful

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-11 17:35:54 +03:00
Evgeniy Kulikov
b2a2b5478b Refactoring API
- api.Error should implement error interface
- add method that encodes the response into ResponseWriter

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-11 17:34:06 +03:00
Evgeniy Kulikov
64429d736d Refactoring API layer
- logging RequestID
- should return error, when headers already received

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-11 14:32:04 +03:00
Evgeniy Kulikov
59e26d45fd Refactoring API router
- method to fetch request id
- middleware to set request id and info
- fixes for getAPIErrorResponse (fix possible NPE)

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-11 14:30:02 +03:00
Evgeniy Kulikov
26f1df2721 Refactoring request info
- simplify
- more usable

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-11 14:27:31 +03:00
Evgeniy Kulikov
0161d2fbd3 [#13] Rename go module name according to NSPCC standards
- refactoring s3 gate structure
- cleanup unused code
- rename go module to `github.com/nspcc-dev/neofs-s3-gate`

closes #13

Signed-off-by: Evgeniy Kulikov <kim@nspcc.ru>
2020-08-06 15:02:13 +03:00