update handler options
This commit is contained in:
@ -11,10 +11,7 @@ type MapAuthenticator struct {
|
||||
}
|
||||
|
||||
// NewMapAuthenticator creates an Authenticator that authenticates client by local infos.
|
||||
func NewMapAuthenticator(kvs map[string]string) *MapAuthenticator {
|
||||
if kvs == nil {
|
||||
kvs = make(map[string]string)
|
||||
}
|
||||
func NewMapAuthenticator(kvs map[string]string) Authenticator {
|
||||
return &MapAuthenticator{
|
||||
kvs: kvs,
|
||||
}
|
||||
@ -22,11 +19,7 @@ func NewMapAuthenticator(kvs map[string]string) *MapAuthenticator {
|
||||
|
||||
// Authenticate checks the validity of the provided user-password pair.
|
||||
func (au *MapAuthenticator) Authenticate(user, password string) bool {
|
||||
if au == nil {
|
||||
return true
|
||||
}
|
||||
|
||||
if len(au.kvs) == 0 {
|
||||
if au == nil || len(au.kvs) == 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user