mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-17 05:42:09 +08:00
Using types intstead of several type in auth file
This commit is contained in:
parent
b57163a0e4
commit
83197b1ebb
16
auth.go
16
auth.go
@ -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 == "" {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user