auth

package
v1.8.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToken

func AddToken(next http.RoundTripper, token string) http.RoundTripper

AddToken sets authorization header. If token is empty it immediately returns the next handler.

func ValidateToken

func ValidateToken(token string, penalty time.Duration,
	unauthorizedBody json.RawMessage) func(http.Handler) http.Handler

ValidateToken is http server middleware that checks if Authorization header contains `Bearer token`. If not the execution would be held for the penalty duration and then 401 status code with provided body would be returned. If token is empty it immediately returns the next handler.

Types

This section is empty.

Jump to

Keyboard shortcuts

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