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
9ae306e4
Commit
9ae306e4
authored
Jan 24, 2019
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use defer to make sure we always release session data
parent
fd0f9f2d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
5 deletions
+8
-5
pkg/api/http_server.go
+2
-1
pkg/middleware/auth_proxy.go
+6
-4
No files found.
pkg/api/http_server.go
View file @
9ae306e4
...
...
@@ -65,6 +65,8 @@ func (hs *HTTPServer) Init() error {
hs
.
macaron
=
hs
.
newMacaron
()
hs
.
registerRoutes
()
session
.
Init
(
&
setting
.
SessionOptions
,
setting
.
SessionConnMaxLifetime
)
return
nil
}
...
...
@@ -225,7 +227,6 @@ func (hs *HTTPServer) addMiddlewaresAndStaticRoutes() {
m
.
Use
(
hs
.
metricsEndpoint
)
m
.
Use
(
middleware
.
GetContextHandler
(
hs
.
AuthTokenService
))
m
.
Use
(
middleware
.
OrgRedirect
())
session
.
Init
(
&
setting
.
SessionOptions
,
setting
.
SessionConnMaxLifetime
)
// needs to be after context handler
if
setting
.
EnforceDomain
{
...
...
pkg/middleware/auth_proxy.go
View file @
9ae306e4
...
...
@@ -42,6 +42,12 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
return
false
}
defer
func
()
{
if
err
:=
ctx
.
Session
.
Release
();
err
!=
nil
{
ctx
.
Logger
.
Error
(
"failed to save session data"
,
"error"
,
err
)
}
}()
query
:=
&
m
.
GetSignedInUserQuery
{
OrgId
:
orgID
}
// if this session has already been authenticated by authProxy just load the user
...
...
@@ -163,10 +169,6 @@ func initContextWithAuthProxy(ctx *m.ReqContext, orgID int64) bool {
ctx
.
IsSignedIn
=
true
ctx
.
Session
.
Set
(
session
.
SESS_KEY_USERID
,
ctx
.
UserId
)
if
err
:=
ctx
.
Session
.
Release
();
err
!=
nil
{
ctx
.
Logger
.
Error
(
"failed to save session data"
,
"error"
,
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