diff --git a/README.md b/README.md index 092ffd0..7da4b4d 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Adminio-API expose metrics for [Prometheus](https://prometheus.io/) at `/metrics | `MINIO_REGION` | set minio region | us-east-1 | | `MINIO_ACCESS` | set minio Access Key | test | | `MINIO_SECRET` | set minio Secret Key | testtest123 | +| `MINIO_DEFAULT_LOCK_OBLECT_ENABLE` | set minio default make bucket behaviour with locking object | false | | `ADMINIO_CORS_DOMAIN` | set adminio-api CORS policy domain | * | | `ADMINIO_OAUTH_ENABLE` | enable oauth over supported providers | false | | `ADMINIO_OAUTH_PROVIDER` | oauth provider, for more information see the full list of supported providers | github | diff --git a/openAPI/openapi_v3.yaml b/openAPI/openapi_v3.yaml index 4992295..c283570 100644 --- a/openAPI/openapi_v3.yaml +++ b/openAPI/openapi_v3.yaml @@ -1,7 +1,7 @@ openapi: "3.0.0" info: description: "Adminio API" - version: "2.3.0" + version: "2.4.0" title: "Adminio API" contact: name: "rzrbld at github.com" @@ -66,6 +66,11 @@ paths: type: string format: string newBucketRegion: + description: Optional parameter. if value is null value will be retrieved from ENV variable + type: string + format: string + newBucketObjectLocking: + description: Optional parameter. if value is null value will be retrieved from ENV variable type: string format: string responses: @@ -473,6 +478,98 @@ paths: application/json: schema: $ref: "#/components/schemas/Error" + /bucket/set-encryption: + post: + summary: Set bucket encryption + operationId: setBucketEncryption + tags: + - bucket + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + bucketName: + type: string + format: string + bucketEncryptionType: + description: available options is sse-kms ans sse-s3 + type: string + format: string + kmsMasterKey: + description: master key ID if use sse-kms + type: string + format: string + responses: + '200': + description: Success + content: + application/json: + schema: + $ref: "#/components/schemas/Success" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /bucket/get-encryption: + post: + summary: Get bucket encryption + operationId: getBucketEncryption + tags: + - bucket + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + bucketName: + type: string + format: string + responses: + '200': + description: bucket encryption + content: + application/json: + schema: + $ref: "#/components/schemas/BucketEncryption" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + /bucket/remove-encryption: + post: + summary: Remove bucket encryption + operationId: removeBucketEncryption + tags: + - bucket + requestBody: + content: + multipart/form-data: + schema: + type: object + properties: + bucketName: + type: string + format: string + responses: + '200': + description: bucket encryption removed + content: + application/json: + schema: + $ref: "#/components/schemas/Success" + default: + description: unexpected error + content: + application/json: + schema: + $ref: "#/components/schemas/Error" /users/list: get: summary: List all users @@ -1125,7 +1222,20 @@ components: type: array items: type: string - + BucketEncryption: + type: object + properties: + XMLname: + type: object + properties: + Space: + type: string + Local: + type: string + Rules: + type: array + items: + type: object BucketEvent: type: object properties: @@ -1184,6 +1294,8 @@ components: $ref: "#/components/schemas/BucketTags" policy: type: string + encryption: + $ref: "#/components/schemas/BucketEncryption" BucketLifecycle: type: string Error: @@ -1201,4 +1313,3 @@ components: properties: Success: type: string - diff --git a/src/clients/clients.go b/src/clients/clients.go index 81dc98d..15d8e80 100644 --- a/src/clients/clients.go +++ b/src/clients/clients.go @@ -1,14 +1,21 @@ package clients import ( - minio "github.com/minio/minio-go/v6" + minio "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/credentials" madmin "github.com/minio/minio/pkg/madmin" cnf "github.com/rzrbld/adminio-api/config" "log" ) var MadmClnt, MadmErr = madmin.New(cnf.Server, cnf.Maccess, cnf.Msecret, cnf.Ssl) -var MinioClnt, MinioErr = minio.New(cnf.Server, cnf.Maccess, cnf.Msecret, cnf.Ssl) + +// var MinioClnt, MinioErr = minio.New(cnf.Server, cnf.Maccess, cnf.Msecret, cnf.Ssl) + +var MinioClnt, MinioErr = minio.New(cnf.Server, &minio.Options{ + Creds: credentials.NewStaticV4(cnf.Maccess, cnf.Msecret, ""), + Secure: cnf.Ssl, +}) func main() { if MadmErr != nil { diff --git a/src/config/config.go b/src/config/config.go index 216302f..1f17d5d 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -6,13 +6,15 @@ import ( ) var ( - Server = getEnv("MINIO_HOST_PORT", "localhost:9000") - Maccess = getEnv("MINIO_ACCESS", "test") - Msecret = getEnv("MINIO_SECRET", "testtest123") - Region = getEnv("MINIO_REGION", "us-east-1") - Ssl, _ = strconv.ParseBool(getEnv("MINIO_SSL", "false")) - ServerHostPort = getEnv("ADMINIO_HOST_PORT", "localhost:8080") - AdminioCORS = getEnv("ADMINIO_CORS_DOMAIN", "*") + Server = getEnv("MINIO_HOST_PORT", "localhost:9000") + Maccess = getEnv("MINIO_ACCESS", "test") + Msecret = getEnv("MINIO_SECRET", "testtest123") + Region = getEnv("MINIO_REGION", "us-east-1") + // Enable object locking by default + DefaultObjectLocking, _ = strconv.ParseBool(getEnv("MINIO_DEFAULT_LOCK_OBLECT_ENABLE", "false")) + Ssl, _ = strconv.ParseBool(getEnv("MINIO_SSL", "false")) + ServerHostPort = getEnv("ADMINIO_HOST_PORT", "localhost:8080") + AdminioCORS = getEnv("ADMINIO_CORS_DOMAIN", "*") // AES only supports key sizes of 16, 24 or 32 bytes. // You either need to provide exactly that amount or you derive the key from what you type in. ScHashKey = getEnv("ADMINIO_COOKIE_HASH_KEY", "NRUeuq6AdskNPa7ewZuxG9TrDZC4xFat") diff --git a/src/go.mod b/src/go.mod index 2a57ead..92bd3a5 100644 --- a/src/go.mod +++ b/src/go.mod @@ -17,11 +17,12 @@ require ( github.com/eapache/go-resiliency v1.2.0 // indirect github.com/etcd-io/bbolt v1.3.3 // indirect github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 // indirect + github.com/flosch/pongo2/v4 v4.0.1 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/gavv/httpexpect v2.0.0+incompatible // indirect github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 // indirect github.com/go-check/check v0.0.0-20200902074654-038fdea0a05b // indirect - github.com/google/go-cmp v0.5.3 // indirect + github.com/google/go-cmp v0.5.4 // indirect github.com/google/go-querystring v1.0.0 // indirect github.com/gopherjs/gopherjs v0.0.0-20200217142428-fce0ec30dd00 // indirect github.com/gorilla/securecookie v1.1.1 @@ -51,9 +52,9 @@ require ( github.com/minio/hdfs/v3 v3.0.1 // indirect github.com/minio/lsync v1.0.1 // indirect github.com/minio/md5-simd v1.1.1 // indirect - github.com/minio/minio v0.0.0-20201117171328-7ff8128f15ce + github.com/minio/minio v0.0.0-20201129051545-bdd094bc3927 github.com/minio/minio-go/v6 v6.0.58-0.20200612001654-a57fec8037ec - github.com/minio/minio-go/v7 v7.0.6-0.20200929220449-755b5633803a + github.com/minio/minio-go/v7 v7.0.6 github.com/minio/parquet-go v0.0.0-20200414234858-838cfa8aae61 // indirect github.com/montanaflynn/stats v0.6.3 // indirect github.com/moul/http2curl v1.0.0 // indirect @@ -80,11 +81,12 @@ require ( github.com/smartystreets/goconvey v1.6.4 // indirect github.com/square/go-jose/v3 v3.0.0-20200630053402-0a67ce9b0693 // indirect github.com/stretchr/testify v1.6.1 // indirect + github.com/tdewolff/parse/v2 v2.5.6 // indirect github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5 // indirect github.com/ugorji/go v1.1.5-pre // indirect github.com/valyala/fasthttp v1.16.0 // indirect github.com/vmihailenco/msgpack/v4 v4.3.11 // indirect - github.com/vmihailenco/msgpack/v5 v5.0.0-rc.5 // indirect + github.com/vmihailenco/msgpack/v5 v5.0.0 // indirect github.com/vmihailenco/tagparser v0.1.2 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonschema v1.2.0 // indirect @@ -93,15 +95,16 @@ require ( github.com/yudai/golcs v0.0.0-20170316035057-ecda9a501e82 // indirect github.com/yudai/pp v2.0.1+incompatible // indirect go.uber.org/zap v1.15.0 // indirect - golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 // indirect + golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 // indirect golang.org/x/net v0.0.0-20201110031124-69a78807bb2b // indirect golang.org/x/oauth2 v0.0.0-20201109201403-9fd604954f58 // indirect - golang.org/x/sys v0.0.0-20201117222635-ba5294a509c7 // indirect + golang.org/x/sys v0.0.0-20201126233918-771906719818 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/protobuf v1.25.0 // indirect + gopkg.in/check.v1 v1.0.0-20201128035030-22ab2dfb190c // indirect gopkg.in/cheggaaa/pb.v1 v1.0.28 // indirect gopkg.in/ini.v1 v1.62.0 // indirect - gopkg.in/yaml.v2 v2.3.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776 // indirect ) diff --git a/src/go.sum b/src/go.sum index 01a4c70..f43453e 100644 --- a/src/go.sum +++ b/src/go.sum @@ -143,6 +143,7 @@ github.com/cespare/xxhash/v2 v2.1.1 h1:6MnRN8NT7+YBpUIWxHtefFZOKTAPgGjpQSxqLNn0+ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= github.com/cheggaaa/pb v1.0.28/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= +github.com/cheggaaa/pb v1.0.29/go.mod h1:W40334L7FMC5JKWldsTWbdGjLo0RxUKK73K+TuPxX30= github.com/chris-ramon/douceur v0.2.0 h1:IDMEdxlEUUBYBKE4z/mJnFyVXox+MjuEVDJNN27glkU= github.com/chris-ramon/douceur v0.2.0/go.mod h1:wDW5xjJdeoMm1mRt4sD4c/LbF/mWdEpRXQKjTR8nIBE= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= @@ -214,10 +215,13 @@ github.com/etcd-io/gofail v0.0.0-20190801230047-ad7f989257ca/go.mod h1:49H/RkXP8 github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072 h1:DddqAaWDpywytcG8w/qoQ5sAN8X12d3Z3koB0C3Rxsc= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0 h1:Q7juDM0QtcnhCpeyLGQKyg4TOIghuNXrkL32pHAUMxo= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/flosch/pongo2/v4 v4.0.0 h1:6eZe8NSNxtTTGwXgJqqXiiLEDAj7CvkwiYrZFQRW6cQ= github.com/flosch/pongo2/v4 v4.0.0/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= +github.com/flosch/pongo2/v4 v4.0.1 h1:l/49mdkeTYSHzH9N4Iwjs0yMqELMKCsYv5PzTm37Gio= +github.com/flosch/pongo2/v4 v4.0.1/go.mod h1:B5ObFANs/36VwxxlgKpdchIJHMvHB562PW+BWPhwZD8= github.com/fortytw2/leaktest v1.2.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -321,6 +325,8 @@ github.com/google/go-cmp v0.5.2 h1:X2ev0eStA3AbceY54o37/0PQ/UWqKEiiO2dKL5OPaFM= github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.3 h1:x95R7cp+rSeeqAMI2knLtQ0DKlaBhv2NrtrOvafPHRo= github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.4 h1:L8R9j+yAqZuZjsqh/z+F1NCffTKKLShY6zXTItVIZ8M= +github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -571,6 +577,7 @@ github.com/klauspost/cpuid v1.3.0/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd github.com/klauspost/cpuid v1.3.1 h1:5JNjFYYQrZeKRJ0734q51WCEEn2huer72Dc7K+R/b6s= github.com/klauspost/cpuid v1.3.1/go.mod h1:bYW4mA6ZgKPob1/Dlai2LviZJO7KGI3uoWLd42rAQw4= github.com/klauspost/pgzip v1.2.1/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= +github.com/klauspost/pgzip v1.2.5/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/klauspost/readahead v1.3.1/go.mod h1:AH9juHzNH7xqdqFHrMRSHeH2Ps+vFf+kblDqzPFiLJg= github.com/klauspost/reedsolomon v1.9.7/go.mod h1:+8WD025Xpby8/kG5h/HDPIFhiiuGEtZOKw+5Y4drAD8= github.com/klauspost/reedsolomon v1.9.9/go.mod h1:O7yFFHiQwDR6b2t63KPUpccPtNdp5ADgh1gg4fd12wo= @@ -631,6 +638,7 @@ github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd github.com/mattn/go-isatty v0.0.7 h1:UvyT9uN+3r7yLEYSlJsbQGdsaB/a0DlgWP3pql6iwOc= github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -684,6 +692,10 @@ github.com/minio/minio v0.0.0-20201010033600-c2f16ee84624 h1:egQj7JCP1E2rUBlw9+C github.com/minio/minio v0.0.0-20201010033600-c2f16ee84624/go.mod h1:+X3EEHIpFylDGXYFMTmieXHTwaCkDZNrPiZdph7loNw= github.com/minio/minio v0.0.0-20201117171328-7ff8128f15ce h1:KqjsZDwPscSvigbCXifaSOEGCzwthCdU4odN4l+S/7k= github.com/minio/minio v0.0.0-20201117171328-7ff8128f15ce/go.mod h1:CG2Z6ih3hItDrDvl2JhPapjfO9Q+khsggYP5SEwBBf4= +github.com/minio/minio v0.0.0-20201129051545-bdd094bc3927 h1:l0Y1T5Nbft6VJq0tIJnpSFY4oD/pzzs5ZEF5pFSOMSI= +github.com/minio/minio v0.0.0-20201129051545-bdd094bc3927/go.mod h1:RvC4rtbp4pykaWxcJXQGu2QirCeXiyquSyPkadJiiFQ= +github.com/minio/minio-go v1.0.0 h1:ooSujki+Z1PRGZsYffJw5jnF5eMBvzMVV86TLAlM0UM= +github.com/minio/minio-go v6.0.14+incompatible h1:fnV+GD28LeqdN6vT2XdGKW8Qe/IfjJDswNVuni6km9o= github.com/minio/minio-go/v6 v6.0.53 h1:8jzpwiOzZ5Iz7/goFWqNZRICbyWYShbb5rARjrnSCNI= github.com/minio/minio-go/v6 v6.0.53/go.mod h1:DIvC/IApeHX8q1BAMVCXSXwpmrmM+I+iBvhvztQorfI= github.com/minio/minio-go/v6 v6.0.55-0.20200425081427-89eebdef2af0/go.mod h1:KQMM+/44DSlSGSQWSfRrAZ12FVMmpWNuX37i2AX0jfI= @@ -702,6 +714,9 @@ github.com/minio/minio-go/v7 v7.0.5 h1:I2NIJ2ojwJqD/YByemC1M59e1b4FW9kS7NlOar7HP github.com/minio/minio-go/v7 v7.0.5/go.mod h1:TA0CQCjJZHM5SJj9IjqR0NmpmQJ6bCbXifAJ3mUU6Hw= github.com/minio/minio-go/v7 v7.0.6-0.20200929220449-755b5633803a h1:duFwQxzoPzBt4LbaftSVVTDwRrpuMIKI6XoJ5mKSaOs= github.com/minio/minio-go/v7 v7.0.6-0.20200929220449-755b5633803a/go.mod h1:CSt2ETZNs+bIIhWTse0mcZKZWMGrFU7Er7RR0TmkDYk= +github.com/minio/minio-go/v7 v7.0.6-0.20201118225257-f6869a5e2a6a/go.mod h1:HcIuq+11d/3MfavIPZiswSzfQ1VJ2Lwxp/XLtW46IWQ= +github.com/minio/minio-go/v7 v7.0.6 h1:9czXaG0LEZ9s74smSqy0rm034MxngQoP6HTTuSc5GEs= +github.com/minio/minio-go/v7 v7.0.6/go.mod h1:HcIuq+11d/3MfavIPZiswSzfQ1VJ2Lwxp/XLtW46IWQ= github.com/minio/parquet-go v0.0.0-20200414234858-838cfa8aae61/go.mod h1:4trzEJ7N1nBTd5Tt7OCZT5SEin+WiAXpdJ/WgPkESA8= github.com/minio/selfupdate v0.3.1/go.mod h1:b8ThJzzH7u2MkF6PcIra7KaXO9Khf6alWPvMSyTDCFM= github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU= @@ -821,6 +836,7 @@ github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/9 github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/philhofer/fwd v1.1.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/philhofer/fwd v1.1.1/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pierrec/lz4 v2.2.6+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= @@ -947,6 +963,7 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.5.0/go.mod h1:+F7Ogzej0PZc/94MaYx/nvG9jOFMD2osvC3s+Squfpo= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3 h1:hBSHahWMEgzwRyS6dRpxY0XyjZsHyQ61s084wo5PJe0= github.com/smartystreets/assertions v0.0.0-20190401211740-f487f9de1cd3/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= @@ -1001,6 +1018,8 @@ github.com/tdewolff/parse/v2 v2.5.4 h1:ggaQ1SVE8wErRrZwUs49I6iQ1zL/tFlb7KtYsk2I8 github.com/tdewolff/parse/v2 v2.5.4/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho= github.com/tdewolff/parse/v2 v2.5.5 h1:b7ICJa4I/54JQGEGgTte8DiyJPKcC5g8V773QMzkeUM= github.com/tdewolff/parse/v2 v2.5.5/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho= +github.com/tdewolff/parse/v2 v2.5.6 h1:fpy81gxFbbPd0Zv0taPAxXc+c96tdo1tZFYXrr2nQlU= +github.com/tdewolff/parse/v2 v2.5.6/go.mod h1:WzaJpRSbwq++EIQHYIRTpbYKNA3gn9it1Ik++q4zyho= github.com/tdewolff/test v1.0.6 h1:76mzYJQ83Op284kMT+63iCNCI7NEERsIN8dLM+RiKr4= github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tidwall/gjson v1.3.5/go.mod h1:P256ACg0Mn+j1RXIDXoss50DeIABTYK1PULOJHhxOls= @@ -1036,6 +1055,8 @@ github.com/vmihailenco/msgpack/v5 v5.0.0-beta.1/go.mod h1:xlngVLeyQ/Qi05oQxhQ+oT github.com/vmihailenco/msgpack/v5 v5.0.0-beta.9/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo= github.com/vmihailenco/msgpack/v5 v5.0.0-rc.5 h1:QTbb3+G613k6SLiaTy4ojs3tAmvgUjN3iA+wFs48w0U= github.com/vmihailenco/msgpack/v5 v5.0.0-rc.5/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo= +github.com/vmihailenco/msgpack/v5 v5.0.0 h1:nCaMMPEyfgwkGc/Y0GreJPhuvzqCqW+Ufq5lY7zLO2c= +github.com/vmihailenco/msgpack/v5 v5.0.0/go.mod h1:HVxBVPUK/+fZMonk4bi1islLa8V3cfnBug0+4dykPzo= github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/vmihailenco/tagparser v0.1.2 h1:gnjoVuB/kljJ5wICEEOpx98oXMWPLj22G67Vbd1qPqc= @@ -1131,6 +1152,8 @@ golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9 h1:phUcVbl53swtrUN8kQEXFhUxPlIlWyBfKmidCu7P95o= golang.org/x/crypto v0.0.0-20201117144127-c1f2f97bffc9/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392 h1:xYJJ3S178yv++9zXV/hnr29plCAGO9vAFG9dorqaFQc= +golang.org/x/crypto v0.0.0-20201124201722-c8d3bf9c5392/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -1318,6 +1341,8 @@ golang.org/x/sys v0.0.0-20201015000850-e3ed0017c211/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20201028094953-708e7fb298ac/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201117222635-ba5294a509c7 h1:s330+6z/Ko3J0o6rvOcwXe5nzs7UT9tLKHoOXYn6uE0= golang.org/x/sys v0.0.0-20201117222635-ba5294a509c7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201126233918-771906719818 h1:f1CIuDlJhwANEC2MM87MBEVMr3jl5bifgsfj90XAF9c= +golang.org/x/sys v0.0.0-20201126233918-771906719818/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1511,6 +1536,8 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8X gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b h1:QRR6H1YWRnHb4Y/HeNFCTJLFVxaq6wH4YuVdsUOr75U= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201128035030-22ab2dfb190c h1:3Ao+zLtE2wq/wqnKi1D1nmaRo1n6E9lEVLlXfdDYsQQ= +gopkg.in/check.v1 v1.0.0-20201128035030-22ab2dfb190c/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/cheggaaa/pb.v1 v1.0.25/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= @@ -1556,6 +1583,8 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2 h1:XZx7nhd5GMaZpmDaEHFVafUZC7ya0fuo7cSJ3UCKYmM= gopkg.in/yaml.v3 v3.0.0-20191120175047-4206685974f2/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/src/handlers/buckets.go b/src/handlers/buckets.go index 6f8dd3f..e8e28ae 100644 --- a/src/handlers/buckets.go +++ b/src/handlers/buckets.go @@ -3,6 +3,7 @@ package handlers import ( "context" "encoding/json" + "encoding/xml" "fmt" log "log" "strconv" @@ -10,9 +11,12 @@ import ( "sync" iris "github.com/kataras/iris/v12" - minio "github.com/minio/minio-go/v6" - policy "github.com/minio/minio-go/v6/pkg/policy" - "github.com/minio/minio-go/v6/pkg/tags" + minio "github.com/minio/minio-go/v7" + "github.com/minio/minio-go/v7/pkg/lifecycle" + "github.com/minio/minio-go/v7/pkg/notification" + policy "github.com/minio/minio-go/v7/pkg/policy" + "github.com/minio/minio-go/v7/pkg/sse" + "github.com/minio/minio-go/v7/pkg/tags" madmin "github.com/minio/minio/pkg/madmin" cnf "github.com/rzrbld/adminio-api/config" resph "github.com/rzrbld/adminio-api/response" @@ -21,7 +25,7 @@ import ( func getPolicyWithName(bucketName string) (string, string, error) { var p policy.BucketAccessPolicy - bp, err := minioClnt.GetBucketPolicyWithContext(context.Background(), bucketName) + bp, err := minioClnt.GetBucketPolicy(context.Background(), bucketName) policyShort := "none" if bp != "" { if err = json.Unmarshal([]byte(bp), &p); err != nil { @@ -77,7 +81,7 @@ func isJSON(s string) bool { } var BuckList = func(ctx iris.Context) { - lb, err := minioClnt.ListBuckets() + lb, err := minioClnt.ListBuckets(context.Background()) var res = resph.BodyResHandler(ctx, err, lb) ctx.JSON(res) } @@ -86,19 +90,20 @@ var BuckListExtended = func(ctx iris.Context) { var wg sync.WaitGroup - lb, err := minioClnt.ListBuckets() + lb, err := minioClnt.ListBuckets(context.Background()) allBuckets := make([]iris.Map, len(lb)) wg.Add(len(lb)) for i := 0; i < len(lb); i++ { go func(i int) { bucket := lb[i] - bn, err := minioClnt.GetBucketNotification(bucket.Name) + bn, err := minioClnt.GetBucketNotification(context.Background(), bucket.Name) if err != nil { log.Print("Error while getting bucket notification", err) } bq, _ := madmClnt.GetBucketQuota(context.Background(), bucket.Name) - bt, bterr := minioClnt.GetBucketTaggingWithContext(context.Background(), bucket.Name) + bt, bterr := minioClnt.GetBucketTagging(context.Background(), bucket.Name) + be, _ := minioClnt.GetBucketEncryption(context.Background(), bucket.Name) pName, _, _ := getPolicyWithName(bucket.Name) @@ -108,7 +113,7 @@ var BuckListExtended = func(ctx iris.Context) { btMap = bt.ToMap() } - br := iris.Map{"name": bucket.Name, "info": bucket, "events": bn, "quota": bq, "tags": btMap, "policy": pName} + br := iris.Map{"name": bucket.Name, "info": bucket, "events": bn, "quota": bq, "tags": btMap, "policy": pName, "encryption": be} allBuckets[i] = br wg.Done() }(i) @@ -129,7 +134,7 @@ var BuckSetTags = func(ctx iris.Context) { } if resph.CheckAuthBeforeRequest(ctx) != false { - err := minioClnt.SetBucketTaggingWithContext(context.Background(), bucketName, bucketTags) + err := minioClnt.SetBucketTagging(context.Background(), bucketName, bucketTags) var res = resph.DefaultResHandler(ctx, err) ctx.JSON(res) } else { @@ -141,7 +146,7 @@ var BuckGetTags = func(ctx iris.Context) { var bucketName = ctx.FormValue("bucketName") if resph.CheckAuthBeforeRequest(ctx) != false { - bt, bterr := minioClnt.GetBucketTaggingWithContext(context.Background(), bucketName) + bt, bterr := minioClnt.GetBucketTagging(context.Background(), bucketName) btMap := map[string]string{} @@ -160,13 +165,25 @@ var BuckGetTags = func(ctx iris.Context) { var BuckMake = func(ctx iris.Context) { var newBucket = ctx.FormValue("newBucket") var newBucketRegion = ctx.FormValue("newBucketRegion") + var newBucketObjectLockingStr = ctx.FormValue("newBucketObjectLocking") + var newBucketObjectLocking bool if newBucketRegion == "" { newBucketRegion = cnf.Region } + if newBucketObjectLockingStr == "" { + newBucketObjectLocking = cnf.DefaultObjectLocking + } else { + newBucketObjectLocking, _ = strconv.ParseBool(newBucketObjectLockingStr) + } + if resph.CheckAuthBeforeRequest(ctx) != false { - err := minioClnt.MakeBucket(newBucket, newBucketRegion) + newBucketOpts := minio.MakeBucketOptions{ + Region: newBucketRegion, + ObjectLocking: newBucketObjectLocking, + } + err := minioClnt.MakeBucket(context.Background(), newBucket, newBucketOpts) var res = resph.DefaultResHandler(ctx, err) ctx.JSON(res) } else { @@ -178,7 +195,7 @@ var BuckDelete = func(ctx iris.Context) { var bucketName = ctx.FormValue("bucketName") if resph.CheckAuthBeforeRequest(ctx) != false { - err := minioClnt.RemoveBucket(bucketName) + err := minioClnt.RemoveBucket(context.Background(), bucketName) var res = resph.DefaultResHandler(ctx, err) ctx.JSON(res) } else { @@ -189,28 +206,34 @@ var BuckDelete = func(ctx iris.Context) { var BuckGetLifecycle = func(ctx iris.Context) { var bucketName = ctx.FormValue("bucketName") - lc, err := minioClnt.GetBucketLifecycle(bucketName) + lc, err := minioClnt.GetBucketLifecycle(context.Background(), bucketName) var res = resph.BodyResHandler(ctx, err, lc) ctx.JSON(res) } var BuckSetLifecycle = func(ctx iris.Context) { var bucketName = ctx.FormValue("bucketName") - var lifecycle = ctx.FormValue("lifecycle") - - if resph.CheckAuthBeforeRequest(ctx) != false { - err := minioClnt.SetBucketLifecycle(bucketName, lifecycle) + var lifecycleStr = ctx.FormValue("lifecycle") + lcc := &lifecycle.Configuration{} + err := xml.Unmarshal([]byte(lifecycleStr), &lcc) + if err != nil { var res = resph.DefaultResHandler(ctx, err) ctx.JSON(res) } else { - ctx.JSON(resph.DefaultAuthError()) + if resph.CheckAuthBeforeRequest(ctx) != false { + err := minioClnt.SetBucketLifecycle(context.Background(), bucketName, lcc) + var res = resph.DefaultResHandler(ctx, err) + ctx.JSON(res) + } else { + ctx.JSON(resph.DefaultAuthError()) + } } } var BuckGetEvents = func(ctx iris.Context) { var bucket = ctx.FormValue("bucket") - bn, err := minioClnt.GetBucketNotification(bucket) + bn, err := minioClnt.GetBucketNotification(context.Background(), bucket) var res = resph.BodyResHandler(ctx, err, bn) ctx.JSON(res) } @@ -218,7 +241,7 @@ var BuckGetEvents = func(ctx iris.Context) { var BuckSetEvents = func(ctx iris.Context) { var arrARN = strings.Split(ctx.FormValue("stsARN"), ":") - var stsARN = minio.NewArn(arrARN[1], arrARN[2], arrARN[3], arrARN[4], arrARN[5]) + var stsARN = notification.NewArn(arrARN[1], arrARN[2], arrARN[3], arrARN[4], arrARN[5]) var bucket = ctx.FormValue("bucket") var eventTypes = strings.Split(ctx.FormValue("eventTypes"), ",") @@ -226,17 +249,17 @@ var BuckSetEvents = func(ctx iris.Context) { var filterSuffix = ctx.FormValue("filterSuffix") if resph.CheckAuthBeforeRequest(ctx) != false { - bucketNotify, err := minioClnt.GetBucketNotification(bucket) + bucketNotify, err := minioClnt.GetBucketNotification(context.Background(), bucket) - var newNotification = minio.NewNotificationConfig(stsARN) + var newNotification = notification.NewConfig(stsARN) for _, event := range eventTypes { switch event { case "put": - newNotification.AddEvents(minio.ObjectCreatedAll) + newNotification.AddEvents(notification.ObjectCreatedAll) case "delete": - newNotification.AddEvents(minio.ObjectRemovedAll) + newNotification.AddEvents(notification.ObjectRemovedAll) case "get": - newNotification.AddEvents(minio.ObjectAccessedAll) + newNotification.AddEvents(notification.ObjectAccessedAll) } } if filterPrefix != "" { @@ -261,7 +284,7 @@ var BuckSetEvents = func(ctx iris.Context) { } } - err = minioClnt.SetBucketNotification(bucket, bucketNotify) + err = minioClnt.SetBucketNotification(context.Background(), bucket, bucketNotify) var res = resph.DefaultResHandler(ctx, err) ctx.JSON(res) } else { @@ -273,7 +296,7 @@ var BuckRemoveEvents = func(ctx iris.Context) { var bucket = ctx.FormValue("bucket") if resph.CheckAuthBeforeRequest(ctx) != false { - err := minioClnt.RemoveAllBucketNotification(bucket) + err := minioClnt.RemoveAllBucketNotification(context.Background(), bucket) var res = resph.DefaultResHandler(ctx, err) ctx.JSON(res) } else { @@ -359,7 +382,62 @@ var BuckSetPolicy = func(ctx iris.Context) { } if resph.CheckAuthBeforeRequest(ctx) != false { - err = minioClnt.SetBucketPolicyWithContext(context.Background(), bucket, policyStr) + err = minioClnt.SetBucketPolicy(context.Background(), bucket, policyStr) + var res = resph.DefaultResHandler(ctx, err) + ctx.JSON(res) + } else { + ctx.JSON(resph.DefaultAuthError()) + } +} + +var BuckGetEncryption = func(ctx iris.Context) { + var bucketName = ctx.FormValue("bucketName") + + if resph.CheckAuthBeforeRequest(ctx) != false { + ec, err := minioClnt.GetBucketEncryption(context.Background(), bucketName) + var res = resph.BodyResHandler(ctx, err, ec) + ctx.JSON(res) + } else { + ctx.JSON(resph.DefaultAuthError()) + } +} + +var BuckSetEncryption = func(ctx iris.Context) { + + var bucketName = ctx.FormValue("bucketName") + var bucketEncType = ctx.FormValue("bucketEncryptionType") + var KmsMKey = ctx.FormValue("kmsMasterKey") + var encErr error + var sseConf *sse.Configuration + + switch strings.ToLower(bucketEncType) { + case "sse-kms": + sseConf = sse.NewConfigurationSSEKMS(KmsMKey) + case "sse-s3": + sseConf = sse.NewConfigurationSSES3() + default: + encErr = fmt.Errorf("Invalid encryption algorithm %s", bucketEncType) + } + + if encErr != nil { + var res = resph.DefaultResHandler(ctx, encErr) + ctx.JSON(res) + } else { + if resph.CheckAuthBeforeRequest(ctx) != false { + err := minioClnt.SetBucketEncryption(context.Background(), bucketName, sseConf) + var res = resph.DefaultResHandler(ctx, err) + ctx.JSON(res) + } else { + ctx.JSON(resph.DefaultAuthError()) + } + } +} + +var BuckRemoveEncryption = func(ctx iris.Context) { + var bucketName = ctx.FormValue("bucketName") + + if resph.CheckAuthBeforeRequest(ctx) != false { + err := minioClnt.RemoveBucketEncryption(context.Background(), bucketName) var res = resph.DefaultResHandler(ctx, err) ctx.JSON(res) } else { diff --git a/src/main.go b/src/main.go index 0500d81..a6c8b89 100644 --- a/src/main.go +++ b/src/main.go @@ -44,8 +44,9 @@ func main() { ) fmt.Println("\033[31m\r\n ________ ________ _____ ______ ___ ________ ___ ________ \r\n|\\ __ \\ |\\ ___ \\ |\\ _ \\ _ \\ |\\ \\ |\\ ___ \\ |\\ \\ |\\ __ \\ \r\n\\ \\ \\|\\ \\\\ \\ \\_|\\ \\\\ \\ \\\\\\__\\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\|\\ \\ \r\n \\ \\ __ \\\\ \\ \\ \\\\ \\\\ \\ \\\\|__| \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\\\ \\ \r\n \\ \\ \\ \\ \\\\ \\ \\_\\\\ \\\\ \\ \\ \\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\ \\ \\\\\\ \\ \r\n \\ \\__\\ \\__\\\\ \\_______\\\\ \\__\\ \\ \\__\\\\ \\__\\\\ \\__\\\\ \\__\\\\ \\__\\\\ \\_______\\\r\n \\|__|\\|__| \\|_______| \\|__| \\|__| \\|__| \\|__| \\|__| \\|__| \\|_______|\r\n \r\n \r\n \033[m") + fmt.Println("\033[33mAdmin REST API for http://min.io (minio) s3 server") - fmt.Println("Version : 1.5") + fmt.Println("Version : 1.6") fmt.Println("Authors : rzrbld, 0x003e") fmt.Println("License : MIT") fmt.Println("GitHub : https://github.com/rzrbld/adminio-api") @@ -97,6 +98,9 @@ func main() { v2.Post("/bucket/get-tags", hdl.BuckGetTags) v2.Post("/bucket/get-policy", hdl.BuckGetPolicy) v2.Post("/bucket/set-policy", hdl.BuckSetPolicy) + v2.Post("/bucket/set-encryption", hdl.BuckSetEncryption) + v2.Post("/bucket/get-encryption", hdl.BuckGetEncryption) + v2.Post("/bucket/remove-encryption", hdl.BuckRemoveEncryption) v2.Get("/users/list", hdl.UsrList) v2.Post("/user/set-status", hdl.UsrSetStats) diff --git a/src/oauth/oauth.go b/src/oauth/oauth.go index 2c1c9c4..26ffbab 100644 --- a/src/oauth/oauth.go +++ b/src/oauth/oauth.go @@ -20,7 +20,7 @@ func init() { secureCookie := securecookie.New(hashKey, blockKey) sessionsManager = sessions.New(sessions.Config{ - Cookie: cookieName, + Cookie: cookieName, Encoding: secureCookie, }) }