Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
5777f65d
Commit
5777f65d
authored
Dec 13, 2016
by
Utkarsh Bhatnagar
Committed by
Torkel Ödegaard
Dec 13, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Basic Auth now supports LDAP username and password (#6940)
parent
0841e841
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
+6
-4
docs/sources/http_api/auth.md
+1
-1
pkg/middleware/middleware.go
+5
-3
No files found.
docs/sources/http_api/auth.md
View file @
5777f65d
...
...
@@ -18,7 +18,7 @@ Currently you can authenticate via an `API Token` or via a `Session cookie` (acq
## Basic Auth
If basic auth is enabled (it is enabled by default) you can authenticate your HTTP request via
standard basic auth.
standard basic auth.
Basic auth will also authenticate LDAP users.
curl example:
```
...
...
pkg/middleware/middleware.go
View file @
5777f65d
...
...
@@ -9,6 +9,7 @@ import (
"github.com/grafana/grafana/pkg/bus"
"github.com/grafana/grafana/pkg/components/apikeygen"
"github.com/grafana/grafana/pkg/log"
l
"github.com/grafana/grafana/pkg/login"
"github.com/grafana/grafana/pkg/metrics"
m
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
...
...
@@ -137,6 +138,7 @@ func initContextWithApiKey(ctx *Context) bool {
}
func
initContextWithBasicAuth
(
ctx
*
Context
)
bool
{
if
!
setting
.
BasicAuthEnabled
{
return
false
}
...
...
@@ -160,9 +162,9 @@ func initContextWithBasicAuth(ctx *Context) bool {
user
:=
loginQuery
.
Result
// validate password
if
util
.
EncodePassword
(
password
,
user
.
Salt
)
!=
user
.
Password
{
ctx
.
JsonApiErr
(
401
,
"Invalid username or password"
,
nil
)
loginUserQuery
:=
l
.
LoginUserQuery
{
Username
:
username
,
Password
:
password
,
User
:
user
}
if
err
:=
bus
.
Dispatch
(
&
loginUserQuery
);
err
!=
nil
{
ctx
.
JsonApiErr
(
401
,
"Invalid username or password"
,
err
)
return
true
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment