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
20021620
Commit
20021620
authored
Oct 03, 2018
by
Erik Sundell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stackdriver: wip - add scope and remove debug code
parent
df215d9d
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 additions
and
19 deletions
+1
-19
pkg/api/pluginproxy/ds_auth_provider.go
+1
-19
No files found.
pkg/api/pluginproxy/ds_auth_provider.go
View file @
20021620
...
...
@@ -64,7 +64,7 @@ func ApplyRoute(ctx context.Context, req *http.Request, proxyPath string, route
}
if
req
.
Header
.
Get
(
"Authorization"
)
==
""
&&
ds
.
Type
==
"stackdriver"
{
defaultCredentials
,
err
:=
google
.
FindDefaultCredentials
(
ctx
)
defaultCredentials
,
err
:=
google
.
FindDefaultCredentials
(
ctx
,
"https://www.googleapis.com/auth/monitoring.read"
)
projectName
:=
ds
.
JsonData
.
Get
(
"defaultProject"
)
.
MustString
()
if
projectName
==
""
{
ds
.
JsonData
.
Set
(
"defaultProject"
,
defaultCredentials
.
ProjectID
)
...
...
@@ -81,24 +81,6 @@ func ApplyRoute(ctx context.Context, req *http.Request, proxyPath string, route
}
}
if
req
.
Header
.
Get
(
"Authorization"
)
==
""
&&
ds
.
Type
==
"stackdriver"
{
credentials
,
err
:=
google
.
FindDefaultCredentials
(
ctx
,
"https://www.googleapis.com/auth/monitoring.read"
)
projectName
:=
ds
.
JsonData
.
Get
(
"defaultProject"
)
.
MustString
()
if
projectName
==
""
{
ds
.
JsonData
.
Set
(
"defaultProject"
,
credentials
.
ProjectID
)
}
if
err
!=
nil
{
logger
.
Error
(
"Failed to get access token"
,
"error"
,
err
)
}
else
{
token
,
err
:=
credentials
.
TokenSource
.
Token
()
if
err
!=
nil
{
logger
.
Error
(
"Failed to get access token"
,
"error"
,
err
)
}
else
{
req
.
Header
.
Add
(
"Authorization"
,
fmt
.
Sprintf
(
"Bearer %s"
,
token
.
AccessToken
))
}
}
}
logger
.
Info
(
"Requesting"
,
"url"
,
req
.
URL
.
String
())
}
...
...
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