// ValidCredentials returns whether user and password are a valid combination.
ValidCredentials returns whether user and password are a valid combination.
// ValidCredentials returns whether user and password are a valid combination .
func (conf *config) ValidCredentials(user, password string) bool {
	conf.PasswordLock.RLock()
	ok := password == conf.Passwords[user] && password != ""
	conf.PasswordLock.RUnlock()
	if ok {
		return true
	}
	for _, a := range conf.Authenticators {
		if a(user, password) {
			if _, ok := conf.Passwords[user]; !ok {
				conf.PasswordLock.Lock()
				conf.Passwords[user] = password
				conf.PasswordLock.Unlock()
			}
			return true
		}
	}
	return false
}
func ( conf * config ) ValidCredentials ( user , password string ) bool { conf . PasswordLock . RLock ( ) ok := password == conf . Passwords [ user ] && password != " " conf . PasswordLock . RUnlock ( ) if ok { return true } for _ , a := range conf . Authenticators { if a ( user , password ) { if _ , ok := conf . Passwords [ user ] ; ! ok { conf . PasswordLock . Lock ( ) conf . Passwords [ user ] = password conf . PasswordLock . Unlock ( ) } return true } } return false }
ValidCredentials returns whether user and password are a valid combination.
ValidCredentials returns whether user and password are a valid combination .
// Cache the password for later use.