mirror of
https://github.com/gin-gonic/gin.git
synced 2025-10-18 23:12:17 +08:00
run go fmt
This commit is contained in:
parent
a05220f619
commit
4d8150e363
2
auth.go
2
auth.go
@ -21,7 +21,6 @@ type Accounts map[string]string
|
|||||||
// authKVMap defines a key/value for Authorization token / user
|
// authKVMap defines a key/value for Authorization token / user
|
||||||
type authKVMap map[string]string
|
type authKVMap map[string]string
|
||||||
|
|
||||||
|
|
||||||
func (a authKVMap) searchCredential(authValue string) (string, bool) {
|
func (a authKVMap) searchCredential(authValue string) (string, bool) {
|
||||||
if authValue == "" {
|
if authValue == "" {
|
||||||
return "", false
|
return "", false
|
||||||
@ -33,7 +32,6 @@ func (a authKVMap) searchCredential(authValue string) (string, bool) {
|
|||||||
return user, true
|
return user, true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// BasicAuthForRealm returns a Basic HTTP Authorization middleware. It takes as arguments a map[string]string where
|
// BasicAuthForRealm returns a Basic HTTP Authorization middleware. It takes as arguments a map[string]string where
|
||||||
// the key is the user name and the value is the password, as well as the name of the Realm.
|
// the key is the user name and the value is the password, as well as the name of the Realm.
|
||||||
// If the realm is empty, "Authorization Required" will be used by default.
|
// If the realm is empty, "Authorization Required" will be used by default.
|
||||||
|
@ -20,7 +20,6 @@ func TestBasicAuth(t *testing.T) {
|
|||||||
"bar": "foo",
|
"bar": "foo",
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
assert.Len(t, authMap, 3)
|
assert.Len(t, authMap, 3)
|
||||||
assert.Contains(t, authMap, "Basic YmFyOmZvbw==")
|
assert.Contains(t, authMap, "Basic YmFyOmZvbw==")
|
||||||
assert.Contains(t, authMap, "Basic Zm9vOmJhcg==")
|
assert.Contains(t, authMap, "Basic Zm9vOmJhcg==")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user