docs: Add document to constant `AuthProxyUserKey` and `BasicAuthForProxy`. (#3887)

This commit is contained in:
Endless Paradox 2024-03-13 23:22:05 +08:00 committed by GitHub
parent 990c44aebf
commit ee70b30a97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -15,6 +15,8 @@ import (
// AuthUserKey is the cookie name for user credential in basic auth.
const AuthUserKey = "user"
// AuthProxyUserKey is the cookie name for proxy_user credential in basic auth for proxy.
const AuthProxyUserKey = "proxy_user"
// Accounts defines a key/value for user/pass list of authorized logins.
@ -92,6 +94,7 @@ func authorizationHeader(user, password string) string {
}
// BasicAuthForProxy returns a Basic HTTP Proxy-Authorization middleware.
// If the realm is empty, "Proxy Authorization Required" will be used by default.
func BasicAuthForProxy(accounts Accounts, realm string) HandlerFunc {
if realm == "" {
realm = "Proxy Authorization Required"