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
734a7d38
Unverified
Commit
734a7d38
authored
Jan 21, 2019
by
Marcus Efraimsson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set cookie name from configuration
parent
766cfab3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
pkg/middleware/middleware.go
+1
-1
pkg/services/auth/auth_token.go
+4
-4
No files found.
pkg/middleware/middleware.go
View file @
734a7d38
...
...
@@ -125,7 +125,7 @@ func initContextWithToken(ctx *m.ReqContext, orgID int64, ts *auth.UserAuthToken
ctx
.
Logger
.
Info
(
"new token"
,
"unhashed token"
,
ctx
.
UserToken
.
UnhashedToken
)
ctx
.
Resp
.
Header
()
.
Del
(
"Set-Cookie"
)
cookie
:=
http
.
Cookie
{
Name
:
"grafana_session"
,
Name
:
setting
.
SessionOptions
.
CookieName
,
Value
:
url
.
QueryEscape
(
ctx
.
UserToken
.
UnhashedToken
),
HttpOnly
:
true
,
Domain
:
setting
.
Domain
,
...
...
pkg/services/auth/auth_token.go
View file @
734a7d38
...
...
@@ -37,8 +37,6 @@ func (s *UserAuthTokenService) Init() error {
return
nil
}
const
sessionCookieKey
=
"grafana_session"
func
(
s
*
UserAuthTokenService
)
UserAuthenticatedHook
(
user
*
models
.
User
,
c
*
models
.
ReqContext
)
error
{
userToken
,
err
:=
s
.
CreateToken
(
user
.
Id
,
c
.
RemoteAddr
(),
c
.
Req
.
UserAgent
())
if
err
!=
nil
{
...
...
@@ -47,11 +45,12 @@ func (s *UserAuthTokenService) UserAuthenticatedHook(user *models.User, c *model
c
.
Resp
.
Header
()
.
Del
(
"Set-Cookie"
)
cookie
:=
http
.
Cookie
{
Name
:
se
ssionCookieKey
,
Name
:
se
tting
.
SessionOptions
.
CookieName
,
Value
:
url
.
QueryEscape
(
userToken
.
UnhashedToken
),
HttpOnly
:
true
,
Domain
:
setting
.
Domain
,
Path
:
setting
.
AppSubUrl
+
"/"
,
Secure
:
setting
.
SessionOptions
.
Secure
,
}
http
.
SetCookie
(
c
.
Resp
,
&
cookie
)
...
...
@@ -62,11 +61,12 @@ func (s *UserAuthTokenService) UserAuthenticatedHook(user *models.User, c *model
func
(
s
*
UserAuthTokenService
)
UserSignedOutHook
(
c
*
models
.
ReqContext
)
{
c
.
Resp
.
Header
()
.
Del
(
"Set-Cookie"
)
cookie
:=
http
.
Cookie
{
Name
:
se
ssionCookieKey
,
Name
:
se
tting
.
SessionOptions
.
CookieName
,
Value
:
""
,
HttpOnly
:
true
,
Domain
:
setting
.
Domain
,
Path
:
setting
.
AppSubUrl
+
"/"
,
Secure
:
setting
.
SessionOptions
.
Secure
,
}
http
.
SetCookie
(
c
.
Resp
,
&
cookie
)
}
...
...
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