Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
id
go-sso
Commits
70cd91e6
Commit
70cd91e6
authored
Feb 18, 2018
by
ale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encode the services JSON in the logout handler
parent
11f62905
Pipeline
#915
passed with stages
in 1 minute and 8 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
17 deletions
+19
-17
server/bindata.go
server/bindata.go
+9
-9
server/http.go
server/http.go
+4
-2
server/static/js/logout.js
server/static/js/logout.js
+4
-4
server/templates/logout.html
server/templates/logout.html
+1
-1
server/templates/page.html
server/templates/page.html
+1
-1
No files found.
server/bindata.go
View file @
70cd91e6
...
...
@@ -200,7 +200,7 @@ idlogout.get_services = function() {
return JSON.parse($('#services').attr('data-services'));
};
idlogout.logout_service = function(service) {
idlogout.logout_service = function(
idx,
service) {
var logout_url = service.url + 'sso_logout';
console.log('logging out of ' + service.name);
$.ajax({
...
...
@@ -211,11 +211,11 @@ idlogout.logout_service = function(service) {
withCredentials: true
},
success: function() {
$('#status_'+
service.
idx).class('logout-status-ok').text('OK');
$('#status_'+idx).class('logout-status-ok').text('OK');
console.log('successful logout for ' + service.name);
},
error: function() {
$('#status_'+
service.
idx).class('logout-status-error').text('ERROR');
$('#status_'+idx).class('logout-status-error').text('ERROR');
console.log('error logging out of ' + service.name);
}
});
...
...
@@ -224,7 +224,7 @@ idlogout.logout_service = function(service) {
idlogout.logout = function() {
var services = idlogout.get_services();
$.each(services, function(index, arg) {
idlogout.logout_service(arg);
idlogout.logout_service(
index,
arg);
});
};
...
...
@@ -243,7 +243,7 @@ func staticJsLogoutJs() (*asset, error) {
return
nil
,
err
}
info
:=
bindataFileInfo
{
name
:
"static/js/logout.js"
,
size
:
101
9
,
mode
:
os
.
FileMode
(
436
),
modTime
:
time
.
Unix
(
151896
1249
,
0
)}
info
:=
bindataFileInfo
{
name
:
"static/js/logout.js"
,
size
:
101
5
,
mode
:
os
.
FileMode
(
436
),
modTime
:
time
.
Unix
(
151896
3191
,
0
)}
a
:=
&
asset
{
bytes
:
bytes
,
info
:
info
}
return
a
,
nil
}
...
...
@@ -1276,7 +1276,7 @@ var _templatesLogoutHtml = []byte(`{{template "header" .}}
{{end}}
</ul>
<div id="
#
services" data-services="
[
{{
range $i, $svc := .Services}}{{if gt $i 0}},{{end}}{%22idx%22:{{$i}},%22name%22:%22{{$svc.Name}}%22,%22url%22:%22{{$svc.URL}}%22}{{end}}]
"></div>
<div id="services" data-services="{{
.ServicesJSON}}
"></div>
</div>
{{else}}
...
...
@@ -1313,7 +1313,7 @@ func templatesLogoutHtml() (*asset, error) {
return
nil
,
err
}
info
:=
bindataFileInfo
{
name
:
"templates/logout.html"
,
size
:
1
505
,
mode
:
os
.
FileMode
(
436
),
modTime
:
time
.
Unix
(
151896
124
1
,
0
)}
info
:=
bindataFileInfo
{
name
:
"templates/logout.html"
,
size
:
1
381
,
mode
:
os
.
FileMode
(
436
),
modTime
:
time
.
Unix
(
151896
317
1
,
0
)}
a
:=
&
asset
{
bytes
:
bytes
,
info
:
info
}
return
a
,
nil
}
...
...
@@ -1344,7 +1344,7 @@ var _templatesPageHtml = []byte(`{{define "header"}}<!DOCTYPE html>
<script type="text/javascript" src="/static/js/u2f.js" integrity="sha384-vd6lytRvVm189G5gr34wlOvN672vVBceTZqV+lTSeec0DBLc0GlWLyKDHc6mrIZS"></script>
{{end}}
{{if .IncludeLogoutScripts}}
<script type="text/javascript" src="/static/js/logout.js" integrity="sha384-
+V9VUvMMX5z37HxqZoSrTvQ2vHEH3OPksWy9gyQYfeWdzxtmpNR1r/z3+i0roLxS
"></script>
<script type="text/javascript" src="/static/js/logout.js" integrity="sha384-
swhUuZtRhByZOwc9Obn/dcrmcTXonO4xFuaIZKU3X8Ge/DSv3b+O4rL0+rjzRiRz
"></script>
{{end}}
</body>
</html>
...
...
@@ -1361,7 +1361,7 @@ func templatesPageHtml() (*asset, error) {
return
nil
,
err
}
info
:=
bindataFileInfo
{
name
:
"templates/page.html"
,
size
:
1686
,
mode
:
os
.
FileMode
(
436
),
modTime
:
time
.
Unix
(
151896
1516
,
0
)}
info
:=
bindataFileInfo
{
name
:
"templates/page.html"
,
size
:
1686
,
mode
:
os
.
FileMode
(
436
),
modTime
:
time
.
Unix
(
151896
3201
,
0
)}
a
:=
&
asset
{
bytes
:
bytes
,
info
:
info
}
return
a
,
nil
}
...
...
server/http.go
View file @
70cd91e6
...
...
@@ -5,6 +5,7 @@ package server
import
(
"encoding/gob"
"encoding/json"
"fmt"
"html/template"
"io"
...
...
@@ -234,8 +235,8 @@ func (h *Server) handleHomepage(w http.ResponseWriter, req *http.Request, sessio
}
type
logoutServiceInfo
struct
{
URL
string
Name
string
URL
string
`json:"url"`
Name
string
`json:"name"`
}
func
(
h
*
Server
)
handleLogout
(
w
http
.
ResponseWriter
,
req
*
http
.
Request
,
session
*
authSession
)
{
...
...
@@ -255,6 +256,7 @@ func (h *Server) handleLogout(w http.ResponseWriter, req *http.Request, session
if
req
.
Method
==
"POST"
{
data
[
"IsPOST"
]
=
true
data
[
"IncludeLogoutScripts"
]
=
true
data
[
"ServicesJSON"
],
_
=
json
.
Marshal
(
svcs
)
// Clear the local session.
httpSession
,
_
:=
h
.
authSessionStore
.
Get
(
req
,
authSessionKey
)
...
...
server/static/js/logout.js
View file @
70cd91e6
...
...
@@ -4,7 +4,7 @@ idlogout.get_services = function() {
return
JSON
.
parse
(
$
(
'
#services
'
).
attr
(
'
data-services
'
));
};
idlogout
.
logout_service
=
function
(
service
)
{
idlogout
.
logout_service
=
function
(
idx
,
service
)
{
var
logout_url
=
service
.
url
+
'
sso_logout
'
;
console
.
log
(
'
logging out of
'
+
service
.
name
);
$
.
ajax
({
...
...
@@ -15,11 +15,11 @@ idlogout.logout_service = function(service) {
withCredentials
:
true
},
success
:
function
()
{
$
(
'
#status_
'
+
service
.
idx
).
class
(
'
logout-status-ok
'
).
text
(
'
OK
'
);
$
(
'
#status_
'
+
idx
).
class
(
'
logout-status-ok
'
).
text
(
'
OK
'
);
console
.
log
(
'
successful logout for
'
+
service
.
name
);
},
error
:
function
()
{
$
(
'
#status_
'
+
service
.
idx
).
class
(
'
logout-status-error
'
).
text
(
'
ERROR
'
);
$
(
'
#status_
'
+
idx
).
class
(
'
logout-status-error
'
).
text
(
'
ERROR
'
);
console
.
log
(
'
error logging out of
'
+
service
.
name
);
}
});
...
...
@@ -28,7 +28,7 @@ idlogout.logout_service = function(service) {
idlogout
.
logout
=
function
()
{
var
services
=
idlogout
.
get_services
();
$
.
each
(
services
,
function
(
index
,
arg
)
{
idlogout
.
logout_service
(
arg
);
idlogout
.
logout_service
(
index
,
arg
);
});
};
...
...
server/templates/logout.html
View file @
70cd91e6
...
...
@@ -32,7 +32,7 @@
{{end}}
</ul>
<div
id=
"
#
services"
data-services=
"
[
{{
range $i, $svc := .Services}}{{if gt $i 0}},{{end}}{%22idx%22:{{$i}},%22name%22:%22{{$svc.Name}}%22,%22url%22:%22{{$svc.URL}}%22}{{end}}]
"
></div>
<div
id=
"services"
data-services=
"{{
.ServicesJSON}}
"
></div>
</div>
{{else}}
...
...
server/templates/page.html
View file @
70cd91e6
...
...
@@ -24,7 +24,7 @@
<script
type=
"text/javascript"
src=
"/static/js/u2f.js"
integrity=
"sha384-vd6lytRvVm189G5gr34wlOvN672vVBceTZqV+lTSeec0DBLc0GlWLyKDHc6mrIZS"
></script>
{{end}}
{{if .IncludeLogoutScripts}}
<script
type=
"text/javascript"
src=
"/static/js/logout.js"
integrity=
"sha384-
+V9VUvMMX5z37HxqZoSrTvQ2vHEH3OPksWy9gyQYfeWdzxtmpNR1r/z3+i0roLxS
"
></script>
<script
type=
"text/javascript"
src=
"/static/js/logout.js"
integrity=
"sha384-
swhUuZtRhByZOwc9Obn/dcrmcTXonO4xFuaIZKU3X8Ge/DSv3b+O4rL0+rjzRiRz
"
></script>
{{end}}
</body>
</html>
...
...
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