Skip to content

Commit 2b77ed5

Browse files
committed
feat: add RemoveAccessKey function to clear access key from context
1 parent 92ae235 commit 2b77ed5

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

context.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@ func WithAccessKey(ctx context.Context, accessKey string) context.Context {
106106
return context.WithValue(ctx, ctxKeyAccessKey, accessKey)
107107
}
108108

109+
// RemoveAccessKey removes the access key from the context.
110+
//
111+
// TODO: Deprecate this in favor of Session middleware with a JWT token, and remove this function.
112+
func RemoveAccessKey(ctx context.Context) context.Context {
113+
return context.WithValue(ctx, ctxKeyAccessKey, nil)
114+
}
115+
109116
// GetAccessKey returns the access key from the context.
110117
func GetAccessKey(ctx context.Context) (string, bool) {
111118
v, ok := ctx.Value(ctxKeyAccessKey).(string)

0 commit comments

Comments
 (0)