context

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Copyright Jetstack Ltd. See LICENSE for details.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BearerToken

func BearerToken(req *http.Request) string

BearerToken will return the bearer token stored in the request context.

func ImpersonationConfig

func ImpersonationConfig(req *http.Request) *transport.ImpersonationConfig

ImpersonationConfig returns the impersonation configuration held in the context if existing.

func NoImpersonation

func NoImpersonation(req *http.Request) bool

NoImpersonation returns whether the noImpersonation context key has been set

func RemoteAddr

func RemoteAddr(req *http.Request) (*http.Request, string)

RemoteAddress will attempt to return the source client address if available in the request context. If it is not, it will be gathered from the request and entered into the context.

func WithBearerToken

func WithBearerToken(req *http.Request, header http.Header) *http.Request

WithBearerToken will add the bearer token to the request context from an http.Header to the request context.

func WithImpersonationConfig

func WithImpersonationConfig(req *http.Request, conf *transport.ImpersonationConfig) *http.Request

WithImpersonationConfig returns a copy of parent in which contains the impersonation configuration.

func WithNoImpersonation

func WithNoImpersonation(req *http.Request) *http.Request

WithNoImpersonation returns a copy of the request in which the noImpersonation context value is set.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL