File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ Currently you can authenticate via an `API Token` or via a `Session cookie` (acq
18
18
## Basic Auth
19
19
20
20
If basic auth is enabled (it is enabled by default) you can authenticate your HTTP request via
21
- standard basic auth.
21
+ standard basic auth. Basic auth will also authenticate LDAP users.
22
22
23
23
curl example:
24
24
```
Original file line number Diff line number Diff line change 9
9
"github.com/grafana/grafana/pkg/bus"
10
10
"github.com/grafana/grafana/pkg/components/apikeygen"
11
11
"github.com/grafana/grafana/pkg/log"
12
+ l "github.com/grafana/grafana/pkg/login"
12
13
"github.com/grafana/grafana/pkg/metrics"
13
14
m "github.com/grafana/grafana/pkg/models"
14
15
"github.com/grafana/grafana/pkg/setting"
@@ -137,6 +138,7 @@ func initContextWithApiKey(ctx *Context) bool {
137
138
}
138
139
139
140
func initContextWithBasicAuth (ctx * Context ) bool {
141
+
140
142
if ! setting .BasicAuthEnabled {
141
143
return false
142
144
}
@@ -160,9 +162,9 @@ func initContextWithBasicAuth(ctx *Context) bool {
160
162
161
163
user := loginQuery .Result
162
164
163
- // validate password
164
- if util . EncodePassword ( password , user . Salt ) != user . Password {
165
- ctx .JsonApiErr (401 , "Invalid username or password" , nil )
165
+ loginUserQuery := l. LoginUserQuery { Username : username , Password : password , User : user }
166
+ if err := bus . Dispatch ( & loginUserQuery ); err != nil {
167
+ ctx .JsonApiErr (401 , "Invalid username or password" , err )
166
168
return true
167
169
}
168
170
You can’t perform that action at this time.
0 commit comments