mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-10-24 15:19:25 -04:00
Fix user claims on x-access-token Reva header; initialize cache size
This commit is contained in:
2 files changed
+8
-4
No files matched your search
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in new issue
Block a user