Add option to disable signing keys in the proxy
This commit is contained in:
@@ -135,6 +135,7 @@ type TokenManager struct {
|
||||
// PreSignedURL is the config for the presigned url middleware
|
||||
type PreSignedURL struct {
|
||||
AllowedHTTPMethods []string
|
||||
Enabled bool
|
||||
}
|
||||
|
||||
// MigrationSelectorConf is the config for the migration-selector
|
||||
|
||||
@@ -226,13 +226,19 @@ func ServerWithConfig(cfg *config.Config) []cli.Flag {
|
||||
},
|
||||
|
||||
// Presigned URLs
|
||||
|
||||
&cli.StringSliceFlag{
|
||||
Name: "presignedurl-allow-method",
|
||||
Value: cli.NewStringSlice("GET"),
|
||||
Usage: "--presignedurl-allow-method GET [--presignedurl-allow-method POST]",
|
||||
EnvVars: []string{"PRESIGNEDURL_ALLOWED_METHODS"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "enable-presignedurls",
|
||||
Value: true,
|
||||
Usage: "Enable or disable handling the presigned urls in the proxy",
|
||||
EnvVars: []string{"PROXY_ENABLE_PRESIGNEDURLS"},
|
||||
Destination: &cfg.PreSignedURL.Enabled,
|
||||
},
|
||||
|
||||
// Basic auth
|
||||
&cli.BoolFlag{
|
||||
|
||||
@@ -6,6 +6,11 @@ import (
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/google/uuid"
|
||||
accounts "github.com/owncloud/ocis/accounts/pkg/proto/v0"
|
||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||
@@ -13,10 +18,6 @@ import (
|
||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||
store "github.com/owncloud/ocis/store/pkg/proto/v0"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// SignedURLAuth provides a middleware to check access secured by a signed URL.
|
||||
@@ -96,6 +97,9 @@ func (m signedURLAuth) claims(credential string) (*ocisoidc.StandardClaims, erro
|
||||
}
|
||||
|
||||
func (m signedURLAuth) shouldServe(req *http.Request) bool {
|
||||
if !m.preSignedURLConfig.Enabled {
|
||||
return false
|
||||
}
|
||||
return req.URL.Query().Get("OC-Signature") != ""
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user