add HTTP plugin

This commit is contained in:
ginuerzh
2023-09-20 22:56:43 +08:00
parent afddd2d29e
commit 1760151500
29 changed files with 1032 additions and 147 deletions

View File

@ -97,20 +97,20 @@ func NewAuthenticator(opts ...Option) auth.Authenticator {
}
// Authenticate checks the validity of the provided user-password pair.
func (p *authenticator) Authenticate(ctx context.Context, user, password string) (bool, string) {
func (p *authenticator) Authenticate(ctx context.Context, user, password string) (string, bool) {
if p == nil {
return true, ""
return "", true
}
p.mu.RLock()
defer p.mu.RUnlock()
if len(p.kvs) == 0 {
return false, ""
return "", false
}
v, ok := p.kvs[user]
return ok && (v == "" || password == v), ""
return "", ok && (v == "" || password == v)
}
func (p *authenticator) periodReload(ctx context.Context) error {