switch req.Method { case "login", "plain": ok = (account.Secret == req.Pass) case "cram-md5": expected := CramGetExpected(crypto.MD5, []byte(account.Secret), []byte(req.Salt)) ok = (expected == req.Pass) default: return ErrNotPermittedMethod } if !ok { return ErrPasswordIncorrect }