Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BasicAuthSingleCredentials ¶
func BasicAuthSingleCredentials(handlerFunction http.HandlerFunc, expectedUsername string, expectedPassword string) http.HandlerFunc
BasicAuthSingleCredentials wraps an http.HandlerFunc with HTTP Basic Authentication using a single set of hardcoded credentials.
If the request Authorization header is missing or the provided credentials do not match the expected `username` and `password`, the function responds with a 401 Unauthorized status and a "WWW-Authenticate: Basic" header.
Parameters:
- handlerFunction: The function to be called after successful authentication.
- expectedUsername: The expected username for authentication.
- expectedPassword: The expected password for authentication.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.