Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
go-sso
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
6
Issues
6
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
id
go-sso
Commits
198f7394
Commit
198f7394
authored
Jan 27, 2019
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not ask for explicit confirmation on logout
Fixes issue
#8
.
parent
07c9a990
Pipeline
#2146
passed with stages
in 1 minute and 41 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
68 deletions
+23
-68
server/bindata.go
server/bindata.go
+1
-22
server/http.go
server/http.go
+22
-25
server/templates/logout.html
server/templates/logout.html
+0
-21
No files found.
server/bindata.go
View file @
198f7394
...
...
@@ -1247,7 +1247,6 @@ func templatesLogin_u2fHtml() (*asset, error) {
var
_templatesLogoutHtml
=
[]
byte
(
`{{template "header" .}}
{{if .IsPOST}}
<div class="form-signin">
<h1 class="form-signin-heading>">Sign Out</h1>
...
...
@@ -1287,26 +1286,6 @@ var _templatesLogoutHtml = []byte(`{{template "header" .}}
<div id="services" data-services="{{.ServicesJSON}}"></div>
</div>
{{else}}
<form class="form-signin" action="{{.URLPrefix}}/logout" method="post">
{{.CSRFField}}
<h1 class="form-signin-heading">Sign Out</h1>
<p>
You are about to sign out from the following services:
</p>
<ul>
{{range .Services}}
<li>{{.Name}}</li>
{{end}}
</ul>
<button type="submit" class="btn btn-lg btn-primary btn-block">Logout</button>
</form>
{{end}}
{{template "footer" .}}
`
)
...
...
@@ -1321,7 +1300,7 @@ func templatesLogoutHtml() (*asset, error) {
return
nil
,
err
}
info
:=
bindataFileInfo
{
name
:
"templates/logout.html"
,
size
:
1
524
,
mode
:
os
.
FileMode
(
420
),
modTime
:
time
.
Unix
(
1541234913
,
0
)}
info
:=
bindataFileInfo
{
name
:
"templates/logout.html"
,
size
:
1
063
,
mode
:
os
.
FileMode
(
420
),
modTime
:
time
.
Unix
(
1548600535
,
0
)}
a
:=
&
asset
{
bytes
:
bytes
,
info
:
info
}
return
a
,
nil
}
...
...
server/http.go
View file @
198f7394
...
...
@@ -299,37 +299,34 @@ func (h *Server) handleLogout(w http.ResponseWriter, req *http.Request, session
})
}
svcJSON
,
_
:=
json
.
Marshal
(
svcs
)
// nolint
data
:=
map
[
string
]
interface
{}{
"CSRFField"
:
csrf
.
TemplateField
(
req
),
"URLPrefix"
:
h
.
urlPrefix
,
"Services"
:
svcs
,
"IsPOST"
:
false
,
"CSRFField"
:
csrf
.
TemplateField
(
req
),
"URLPrefix"
:
h
.
urlPrefix
,
"Services"
:
svcs
,
"IncludeLogoutScripts"
:
true
,
"ServicesJSON"
:
string
(
svcJSON
),
}
if
req
.
Method
==
"POST"
{
data
[
"IsPOST"
]
=
true
data
[
"IncludeLogoutScripts"
]
=
true
svcJSON
,
_
:=
json
.
Marshal
(
svcs
)
// nolint
data
[
"ServicesJSON"
]
=
string
(
svcJSON
)
// Clear the local session. Ignore errors.
httpSession
,
_
:=
h
.
authSessionStore
.
Get
(
req
,
authSessionKey
)
// nolint
httpSession
.
Options
.
MaxAge
=
-
1
httpSession
.
Save
(
req
,
w
)
// nolint
// Close the keystore.
if
h
.
keystore
!=
nil
{
var
shard
string
if
session
.
UserInfo
!=
nil
{
shard
=
session
.
UserInfo
.
Shard
}
if
err
:=
h
.
keystore
.
Close
(
req
.
Context
(),
shard
,
session
.
Username
);
err
!=
nil
{
log
.
Printf
(
"failed to wipe keystore for user %s: %v"
,
session
.
Username
,
err
)
}
// Clear the local session. Ignore errors.
httpSession
,
_
:=
h
.
authSessionStore
.
Get
(
req
,
authSessionKey
)
// nolint
delete
(
httpSession
.
Values
,
"data"
)
httpSession
.
Options
.
MaxAge
=
-
1
httpSession
.
Save
(
req
,
w
)
// nolint
// Close the keystore.
if
h
.
keystore
!=
nil
{
var
shard
string
if
session
.
UserInfo
!=
nil
{
shard
=
session
.
UserInfo
.
Shard
}
if
err
:=
h
.
keystore
.
Close
(
req
.
Context
(),
shard
,
session
.
Username
);
err
!=
nil
{
log
.
Printf
(
"failed to wipe keystore for user %s: %v"
,
session
.
Username
,
err
)
}
w
.
Header
()
.
Set
(
"Content-Security-Policy"
,
logoutContentSecurityPolicy
)
}
w
.
Header
()
.
Set
(
"Content-Security-Policy"
,
logoutContentSecurityPolicy
)
h
.
tpl
.
ExecuteTemplate
(
w
,
"logout.html"
,
data
)
// nolint
}
...
...
server/templates/logout.html
View file @
198f7394
{{template "header" .}}
{{if .IsPOST}}
<div
class=
"form-signin"
>
<h1
class=
"form-signin-heading>"
>
Sign Out
</h1>
...
...
@@ -40,25 +39,5 @@
<div
id=
"services"
data-services=
"{{.ServicesJSON}}"
></div>
</div>
{{else}}
<form
class=
"form-signin"
action=
"{{.URLPrefix}}/logout"
method=
"post"
>
{{.CSRFField}}
<h1
class=
"form-signin-heading"
>
Sign Out
</h1>
<p>
You are about to sign out from the following services:
</p>
<ul>
{{range .Services}}
<li>
{{.Name}}
</li>
{{end}}
</ul>
<button
type=
"submit"
class=
"btn btn-lg btn-primary btn-block"
>
Logout
</button>
</form>
{{end}}
{{template "footer" .}}
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