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
88ca54eb
Commit
88ca54eb
authored
Jan 31, 2019
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renames signout function
parent
43ac7968
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
13 deletions
+8
-13
pkg/api/common_test.go
+1
-1
pkg/api/login.go
+1
-1
pkg/middleware/middleware_test.go
+1
-1
pkg/services/auth/auth_token.go
+2
-2
pkg/services/auth/auth_token_test.go
+3
-8
No files found.
pkg/api/common_test.go
View file @
88ca54eb
...
...
@@ -149,4 +149,4 @@ func (s *fakeUserAuthTokenService) UserAuthenticatedHook(user *m.User, c *m.ReqC
return
nil
}
func
(
s
*
fakeUserAuthTokenService
)
UserSignedOutHook
(
c
*
m
.
ReqContext
)
error
{
return
nil
}
func
(
s
*
fakeUserAuthTokenService
)
SignOutUser
(
c
*
m
.
ReqContext
)
error
{
return
nil
}
pkg/api/login.go
View file @
88ca54eb
...
...
@@ -136,7 +136,7 @@ func (hs *HTTPServer) loginUserWithUser(user *m.User, c *m.ReqContext) {
}
func
(
hs
*
HTTPServer
)
Logout
(
c
*
m
.
ReqContext
)
{
hs
.
AuthTokenService
.
UserSignedOutHook
(
c
)
hs
.
AuthTokenService
.
SignOutUser
(
c
)
if
setting
.
SignoutRedirectUrl
!=
""
{
c
.
Redirect
(
setting
.
SignoutRedirectUrl
)
...
...
pkg/middleware/middleware_test.go
View file @
88ca54eb
...
...
@@ -602,4 +602,4 @@ func (s *fakeUserAuthTokenService) UserAuthenticatedHook(user *m.User, c *m.ReqC
return
nil
}
func
(
s
*
fakeUserAuthTokenService
)
UserSignedOutHook
(
c
*
m
.
ReqContext
)
error
{
return
nil
}
func
(
s
*
fakeUserAuthTokenService
)
SignOutUser
(
c
*
m
.
ReqContext
)
error
{
return
nil
}
pkg/services/auth/auth_token.go
View file @
88ca54eb
...
...
@@ -32,7 +32,7 @@ var (
type
UserAuthTokenService
interface
{
InitContextWithToken
(
ctx
*
models
.
ReqContext
,
orgID
int64
)
bool
UserAuthenticatedHook
(
user
*
models
.
User
,
c
*
models
.
ReqContext
)
error
UserSignedOutHook
(
c
*
models
.
ReqContext
)
error
SignOutUser
(
c
*
models
.
ReqContext
)
error
}
type
UserAuthTokenServiceImpl
struct
{
...
...
@@ -112,7 +112,7 @@ func (s *UserAuthTokenServiceImpl) UserAuthenticatedHook(user *models.User, c *m
return
nil
}
func
(
s
*
UserAuthTokenServiceImpl
)
UserSignedOutHook
(
c
*
models
.
ReqContext
)
error
{
func
(
s
*
UserAuthTokenServiceImpl
)
SignOutUser
(
c
*
models
.
ReqContext
)
error
{
unhashedToken
:=
c
.
GetCookie
(
s
.
Cfg
.
LoginCookieName
)
if
unhashedToken
==
""
{
return
errors
.
New
(
"cannot logout without session token"
)
...
...
pkg/services/auth/auth_token_test.go
View file @
88ca54eb
...
...
@@ -51,7 +51,7 @@ func TestUserAuthToken(t *testing.T) {
})
Convey
(
"signing out should delete token and cookie if present"
,
func
()
{
token
,
err
:=
userAuthTokenService
.
CreateToken
(
userID
,
"192.168.1.1:1234"
,
"
some user agent2
"
)
token
,
err
:=
userAuthTokenService
.
CreateToken
(
userID
,
"192.168.1.1:1234"
,
"
user agent
"
)
So
(
err
,
ShouldBeNil
)
So
(
token
,
ShouldNotBeNil
)
...
...
@@ -60,16 +60,11 @@ func TestUserAuthToken(t *testing.T) {
ctx
:=
&
models
.
ReqContext
{
Context
:
&
macaron
.
Context
{
Req
:
macaron
.
Request
{
Request
:
httpreq
}}}
err
=
userAuthTokenService
.
UserSignedOutHook
(
ctx
)
err
=
userAuthTokenService
.
SignOutUser
(
ctx
)
So
(
err
,
ShouldBeNil
)
// makes sure we tell the browser to overwrite the cookie
So
(
ctx
.
Resp
.
Header
()
.
Get
(
"Set-Cookie"
),
ShouldEqual
,
""
)
// lookedUp, err = userAuthTokenService.LookupToken(token.UnhashedToken)
// So(err, ShouldBeNil)
// So(lookedUp, ShouldNotBeNil)
//So(ctx.Resp.Header().Get("Set-Cookie"), ShouldEqual, "")
})
})
...
...
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