mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 15:18:01 +08:00
support passing api token in Basic auth password (#12416)
This commit is contained in:

committed by
Torkel Ödegaard

parent
c2381f088f
commit
3056d9a80e
@ -9,6 +9,7 @@ import (
|
||||
m "github.com/grafana/grafana/pkg/models"
|
||||
"github.com/grafana/grafana/pkg/services/session"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
)
|
||||
|
||||
type AuthOptions struct {
|
||||
@ -34,6 +35,11 @@ func getApiKey(c *m.ReqContext) string {
|
||||
return key
|
||||
}
|
||||
|
||||
username, password, err := util.DecodeBasicAuthHeader(header)
|
||||
if err == nil && username == "api_key" {
|
||||
return password
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user