storj/satellite/console/request.go
Jeremy Wharton 58c5d44f44 satellite/console: integrate sessions into satellite UI
This change integrates the session management database functionality
with the web application. Claim-based authentication has been removed
in favor of session token-based authentication.

Change-Id: I62a4f5354a3ed8ca80272814aad2448f901eab1b
2022-06-13 08:02:02 +00:00

26 lines
571 B
Go

// Copyright (C) 2020 Storj Labs, Inc.
// See LICENSE for copying information.
package console
import (
"context"
"net/http"
)
// requestKey is context key for Requests.
const requestKey key = 1
// WithRequest creates new context with *http.Request.
func WithRequest(ctx context.Context, req *http.Request) context.Context {
return context.WithValue(ctx, requestKey, req)
}
// GetRequest gets *http.Request from context.
func GetRequest(ctx context.Context) *http.Request {
if req, ok := ctx.Value(requestKey).(*http.Request); ok {
return req
}
return nil
}