Documentation ¶
Overview ¶
Package authentication implements a very minimal HTTP Basic Auth header verification mechanism.
Before it can operate it needs to load the credentials from a backend via LoadCredentials().
Currently supported backends:
a CredentialsStore variable directly a Reader which can deliver data as specified in LoadCredentialsFromReader()
Once credentials are loaded the main functionality is available via BasicAuthPassed() which can report if a given Authorization header matches any of the loaded credentials.
Index ¶
Constants ¶
const ( NotAttempted NotBasic Failed Passed )
The possible statuses of authentication process
Variables ¶
This section is empty.
Functions ¶
func BasicAuthPassed ¶
BasicAuthPassed verifies an authHeader to see if it passed HTTP Basic Auth.
func LoadCredentials ¶
func LoadCredentials(backend interface{}) (err error)
LoadCredentials loads the given credentials into the library.
func LoadCredentialsFromReader ¶
LoadCredentialsFromReader loads the credentials from the given r io.Reader into the library. The file must have the format:
username:sha256_of_password
Types ¶
type CredentialsStore ¶
CredentialsStore defines the storage type for credentials.