fix #121. Db user authentication shouldn't fall back to cluster admin authentication
parent
f3b1ec8be1
commit
cdef0f547f
|
@ -603,7 +603,7 @@ func (self *CoordinatorImpl) DropDatabase(user common.User, db string) error {
|
|||
func (self *CoordinatorImpl) AuthenticateDbUser(db, username, password string) (common.User, error) {
|
||||
dbUsers := self.clusterConfiguration.dbUsers[db]
|
||||
if dbUsers == nil || dbUsers[username] == nil {
|
||||
return self.AuthenticateClusterAdmin(username, password)
|
||||
return nil, common.NewAuthorizationError("Invalid username/password")
|
||||
}
|
||||
user := dbUsers[username]
|
||||
if user.isValidPwd(password) {
|
||||
|
|
|
@ -251,6 +251,16 @@ func (self *IntegrationSuite) TestMedians(c *C) {
|
|||
c.Assert(data[0].Points[1][1], Equals, 70.0)
|
||||
}
|
||||
|
||||
func (self *IntegrationSuite) TestDbUserAuthentication(c *C) {
|
||||
resp, err := http.Get("http://localhost:8086/db/db1/authenticate?u=root&p=root")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(resp.StatusCode, Equals, http.StatusUnauthorized)
|
||||
|
||||
resp, err = http.Get("http://localhost:8086/db/db2/authenticate?u=root&p=root")
|
||||
c.Assert(err, IsNil)
|
||||
c.Assert(resp.StatusCode, Equals, http.StatusUnauthorized)
|
||||
}
|
||||
|
||||
func (self *IntegrationSuite) TestArithmeticOperations(c *C) {
|
||||
queries := map[string][9]float64{
|
||||
"select input + output from test_arithmetic_3.0;": [9]float64{1, 2, 3, 4, 5, 9, 6, 7, 13},
|
||||
|
|
Loading…
Reference in New Issue