remove deprecated context key
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
@@ -30,10 +29,6 @@ const AccountID string = "Account-Id"
|
|||||||
// RoleIDs serves as key for the roles in the context
|
// RoleIDs serves as key for the roles in the context
|
||||||
const RoleIDs string = "Role-Ids"
|
const RoleIDs string = "Role-Ids"
|
||||||
|
|
||||||
// UUIDKey serves as key for the account uuid in the context
|
|
||||||
// Deprecated: UUIDKey exists for compatibility reasons. Use AccountID instead.
|
|
||||||
var UUIDKey struct{}
|
|
||||||
|
|
||||||
// ExtractAccountUUID provides a middleware to extract the account uuid from the x-access-token header value
|
// ExtractAccountUUID provides a middleware to extract the account uuid from the x-access-token header value
|
||||||
// and write it to the context. If there is no x-access-token the middleware is omitted.
|
// and write it to the context. If there is no x-access-token the middleware is omitted.
|
||||||
func ExtractAccountUUID(opts ...account.Option) func(http.Handler) http.Handler {
|
func ExtractAccountUUID(opts ...account.Option) func(http.Handler) http.Handler {
|
||||||
@@ -70,7 +65,6 @@ func ExtractAccountUUID(opts ...account.Option) func(http.Handler) http.Handler
|
|||||||
|
|
||||||
// Important: user.Id.OpaqueId is the AccountUUID. Set this way in the account uuid middleware in ocis-proxy.
|
// Important: user.Id.OpaqueId is the AccountUUID. Set this way in the account uuid middleware in ocis-proxy.
|
||||||
// https://github.com/owncloud/ocis-proxy/blob/ea254d6036592cf9469d757d1295e0c4309d1e63/pkg/middleware/account_uuid.go#L109
|
// https://github.com/owncloud/ocis-proxy/blob/ea254d6036592cf9469d757d1295e0c4309d1e63/pkg/middleware/account_uuid.go#L109
|
||||||
ctx = context.WithValue(ctx, UUIDKey, u.Id.OpaqueId)
|
|
||||||
// TODO: implement token manager in cs3org/reva that uses generic metadata instead of access token from header.
|
// TODO: implement token manager in cs3org/reva that uses generic metadata instead of access token from header.
|
||||||
ctx = metadata.Set(ctx, AccountID, u.Id.OpaqueId)
|
ctx = metadata.Set(ctx, AccountID, u.Id.OpaqueId)
|
||||||
if u.Opaque != nil {
|
if u.Opaque != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user