enable archiver for public shares

This commit is contained in:
David Christofas
2021-10-01 16:41:36 +02:00
parent c88824e7a0
commit fb0380820c
3 changed files with 3 additions and 5 deletions

View File

@@ -61,7 +61,7 @@ func Auth(opts ...account.Option) func(http.Handler) http.Handler {
errorcode.InvalidAuthenticationToken.Render(w, r, http.StatusUnauthorized, "invalid token")
return
}
if ok, err := scope.VerifyScope(tokenScope, r); err != nil || !ok {
if ok, err := scope.VerifyScope(ctx, tokenScope, r); err != nil || !ok {
opt.Logger.Error().Err(err).Msg("verifying scope failed")
errorcode.InvalidAuthenticationToken.Render(w, r, http.StatusUnauthorized, "verifying scope failed")
return

View File

@@ -60,7 +60,7 @@ func ExtractAccountUUID(opts ...account.Option) func(http.Handler) http.Handler
opt.Logger.Error().Err(err)
return
}
if ok, err := scope.VerifyScope(tokenScope, r); err != nil || !ok {
if ok, err := scope.VerifyScope(r.Context(), tokenScope, r); err != nil || !ok {
opt.Logger.Error().Err(err).Msg("verifying scope failed")
return
}

View File

@@ -2,7 +2,6 @@ package middleware
import (
"net/http"
"strings"
gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
)
@@ -10,7 +9,6 @@ import (
const (
headerRevaAccessToken = "x-access-token"
headerShareToken = "public-token"
appProviderPathPrefix = "/app/open"
basicAuthPasswordPrefix = "basic|"
authenticationType = "publicshares"
)
@@ -24,7 +22,7 @@ func PublicShareAuth(opts ...Option) func(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
// Currently we only want to authenticate app open request coming from public shares.
shareToken := r.Header.Get(headerShareToken)
if shareToken == "" || !strings.HasPrefix(appProviderPathPrefix, r.URL.Path) {
if shareToken == "" {
// Don't authenticate
next.ServeHTTP(w, r)
return