Documentation ¶
Index ¶
- Constants
- func ExtractFromGRPCRequest(ctx context.Context) (string, context.Context, error)
- func ExtractOrgID(ctx context.Context) (string, error)
- func ExtractOrgIDFromHTTPRequest(r *http.Request) (string, context.Context, error)
- func ExtractUserID(ctx context.Context) (string, error)
- func ExtractUserIDFromHTTPRequest(r *http.Request) (string, context.Context, error)
- func InjectIntoGRPCRequest(ctx context.Context) (context.Context, error)
- func InjectOrgID(ctx context.Context, orgID string) context.Context
- func InjectOrgIDIntoHTTPRequest(ctx context.Context, r *http.Request) error
- func InjectUserID(ctx context.Context, userID string) context.Context
- func InjectUserIDIntoHTTPRequest(ctx context.Context, r *http.Request) error
- func LogWith(ctx context.Context, log logging.Interface) logging.Interface
Constants ¶
const ( // OrgIDHeaderName denotes the OrgID the request has been authenticated as OrgIDHeaderName = "X-Scope-OrgID" // UserIDHeaderName denotes the UserID the request has been authenticated as UserIDHeaderName = "X-Scope-UserID" )
const ( ErrNoOrgID = errors.Error("no org id") ErrDifferentOrgIDPresent = errors.Error("different org ID already present") ErrTooManyOrgIDs = errors.Error("multiple org IDs present") ErrNoUserID = errors.Error("no user id") ErrDifferentUserIDPresent = errors.Error("different user ID already present") ErrTooManyUserIDs = errors.Error("multiple user IDs present") )
Errors that we return
Variables ¶
This section is empty.
Functions ¶
func ExtractFromGRPCRequest ¶
ExtractFromGRPCRequest extracts the user ID from the request metadata and returns the user ID and a context with the user ID injected.
func ExtractOrgID ¶
ExtractOrgID gets the org ID from the context.
func ExtractOrgIDFromHTTPRequest ¶
ExtractOrgIDFromHTTPRequest extracts the org ID from the request headers and returns the org ID and a context with the org ID embedded.
func ExtractUserID ¶
ExtractUserID gets the user ID from the context.
func ExtractUserIDFromHTTPRequest ¶
ExtractUserIDFromHTTPRequest extracts the org ID from the request headers and returns the org ID and a context with the org ID embedded.
func InjectIntoGRPCRequest ¶
InjectIntoGRPCRequest injects the orgID from the context into the request metadata.
func InjectOrgID ¶
InjectOrgID returns a derived context containing the org ID.
func InjectOrgIDIntoHTTPRequest ¶
InjectOrgIDIntoHTTPRequest injects the orgID from the context into the request headers.
func InjectUserID ¶
InjectUserID returns a derived context containing the user ID.
func InjectUserIDIntoHTTPRequest ¶
InjectUserIDIntoHTTPRequest injects the userID from the context into the request headers.
Types ¶
This section is empty.