Documentation ¶
Index ¶
- Variables
- func Auth(next http.Handler, client *http.Client, nodeInfo nodeutil.NodeInfo, ...) http.Handler
- func DownloadGzippedContent(next http.Handler, prefix string, vars ...string) http.Handler
- func FromContextConfig(ctx context.Context) (cfg *config.Config, ok bool)
- func FromContextHTTPClient(ctx context.Context) (client *http.Client, ok bool)
- func FromContextNodeInfo(ctx context.Context) (nodeInfo nodeutil.NodeInfo, ok bool)
- func FromContextToken(ctx context.Context) (string, bool)
- func GetAuthFromRequest(r *http.Request) (string, error)
- func WithConfigContext(ctx context.Context, cfg *config.Config) context.Context
- func WithHTTPClientContext(ctx context.Context, client *http.Client) context.Context
- func WithNodeInfoContext(ctx context.Context, nodeInfo nodeutil.NodeInfo) context.Context
- func Wrapped(next http.Handler, cfg *config.Config, client *http.Client, ...) http.Handler
Constants ¶
This section is empty.
Variables ¶
var ErrMissingToken = errors.New("Missing token in auth request")
ErrMissingToken is returned by GetAuthFromRequest when JWT is missing.
Functions ¶
func Auth ¶
func Auth(next http.Handler, client *http.Client, nodeInfo nodeutil.NodeInfo, role string) http.Handler
Auth is a middleware that validates a user has a valid JWT to access the given endpoint.
func DownloadGzippedContent ¶
DownloadGzippedContent is a middleware which sets Content-disposition header and makes a postfix for a downloadable item.
func FromContextConfig ¶
FromContextConfig returns a config object from a context
func FromContextHTTPClient ¶
FromContextHTTPClient returns an *http.Client object from a context
func FromContextNodeInfo ¶
FromContextNodeInfo returns a nodeInfo object from a context.
func FromContextToken ¶
FromContextToken returns a token string from a context if available.
func GetAuthFromRequest ¶
GetAuthFromRequest will try to extract JWT from Authorization header.
func WithConfigContext ¶
WithConfigContext wraps a config object into context.
func WithHTTPClientContext ¶
WithHTTPClientContext wraps a *http.Client object into context.
func WithNodeInfoContext ¶
WithNodeInfoContext wraps the NodeInfo object into context.
Types ¶
This section is empty.