Description
Right now, when accessing a bucket with a password, access always works when "creds" is supplied and includes only a single entry. Access becomes increasingly hindered (requests fail with authorization errors) as the number of entries supplied is increased.
For example, this alteration of the couchbase/godbc/n1ql/example/example.go works maybe one time in 10.
package main
|
|
import (
|
"fmt"
|
"io"
|
"os"
|
|
"github.com/couchbase/godbc/n1ql"
|
)
|
|
// Illustrates the use of the raw result interface of the N1QL module.
|
func main() {
|
|
|
db, err := n1ql.OpenExtended("http://localhost:8093")
|
if err != nil {
|
fmt.Println("Failed to open.", err.Error())
|
return
|
}
|
|
ac := "[{\"pass\":\"foo\",\"user\":\"beer-sample\"}, {\"pass\":\"\",\"user\":\"a\"}, {\"pass\":\"\",\"user\":\"b\"}, {\"pass\":\"\",\"user\":\"c\"}, {\"pass\":\"\",\"user\":\"d\"}, {\"pass\":\"\",\"user\":\"e\"}, {\"pass\":\"\",\"user\":\"f\"}, {\"pass\":\"\",\"user\":\"g\"} ]"
|
//ac := "[{\"pass\":\"foo\",\"user\":\"beer-sample\"} ]"
|
n1ql.SetQueryParams("creds", string(ac))
|
|
|
name := "21st Amendment Brewery Cafe"
|
ioSrc, err := db.QueryRaw("select * from `beer-sample` where name = ?", name)
|
|
// Try this query instead, for a much larger (streaming!) output.
|
//ioSrc, err := db.QueryRaw("select * from `beer-sample`")
|
|
// For a command rather than a query, try this.
|
//ioSrc, err := db.ExecRaw("insert into default(key, value) values ('111', { 'a': 1, 'b': 2 })")
|
|
if err != nil {
|
fmt.Printf("ERROR: %s\n", err.Error())
|
}
|
if ioSrc != nil {
|
defer ioSrc.Close()
|
io.Copy(os.Stdout, ioSrc)
|
} else {
|
fmt.Printf("NO OUTPUT.\n")
|
}
|
}
|
The current best bet is that this is a server-side problem; the requests that fail don't seem to be mangled client-side.
Attachments
Issue Links
- depends on
-
MB-17834 query integration with RBAC
- Closed