Fix user claims on x-access-token Reva header; initialize cache size

This commit is contained in:
A.Unger committed 2020-06-12 12:00:21 +02:00
1 parent 74ec961ecc
commit afb2291eb9
2 files changed
+8 -4

No files matched your search

+5 -3
View File
@@ -2,8 +2,10 @@ package middleware
import (
"context"
"github.com/owncloud/ocis-proxy/pkg/config"
"net/http"
"strings"
"github.com/owncloud/ocis-proxy/pkg/config"
revauser "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
"github.com/cs3org/reva/pkg/token/manager/jwt"
@@ -103,13 +105,13 @@ func AccountUUID(opts ...AccountMiddlewareOption) func(next http.Handler) http.H
}
}
l.Debug().Interface("claims", claims).Interface("uuid", uuid).Msgf("Associated claims with uuid")
token, err := tokenManager.MintToken(r.Context(), &revauser.User{
Id: &revauser.UserId{
OpaqueId: uuid,
},
Username: claims.Email,
Username: strings.ToLower(claims.Name),
DisplayName: claims.Name,
})
if err != nil {
+3 -1
View File
@@ -19,7 +19,9 @@ var (
ErrInvalidToken = errors.New("invalid or missing token")
// svcCache caches requests for given services to prevent round trips to the service
svcCache = cache.NewCache()
svcCache = cache.NewCache(
cache.Size(256),
)
// ClaimsKey works as a context key for user claims
ClaimsKey interface{} = "claims"