Using types intstead of several type in auth file

This commit is contained in:
idanieldrew 2022-07-10 23:02:25 +04:30
parent b57163a0e4
commit 83197b1ebb

12
auth.go
View File

@ -16,15 +16,17 @@ import (
// AuthUserKey is the cookie name for user credential in basic auth. // AuthUserKey is the cookie name for user credential in basic auth.
const AuthUserKey = "user" const AuthUserKey = "user"
// Accounts defines a key/value for user/pass list of authorized logins. type (
type Accounts map[string]string // Accounts defines a key/value for user/pass list of authorized logins.
Accounts map[string]string
type authPair struct { authPair struct {
value string value string
user string user string
} }
type authPairs []authPair authPairs []authPair
)
func (a authPairs) searchCredential(authValue string) (string, bool) { func (a authPairs) searchCredential(authValue string) (string, bool) {
if authValue == "" { if authValue == "" {