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

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"
type (
// Accounts defines a key/value for user/pass list of authorized logins. // Accounts defines a key/value for user/pass list of authorized logins.
type Accounts map[string]string 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 == "" {