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.
Click to show internal directories.
Click to hide internal directories.