Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ func WithAccessKey(ctx context.Context, accessKey string) context.Context {
return context.WithValue(ctx, ctxKeyAccessKey, accessKey)
}

// RemoveAccessKey removes the access key from the context.
//
// TODO: Deprecate this in favor of Session middleware with a JWT token, and remove this function.
func RemoveAccessKey(ctx context.Context) context.Context {
return context.WithValue(ctx, ctxKeyAccessKey, nil)
}

// GetAccessKey returns the access key from the context.
func GetAccessKey(ctx context.Context) (string, bool) {
v, ok := ctx.Value(ctxKeyAccessKey).(string)
Expand Down