Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
GIP RENATER
switch-wayf
Commits
a671ab31
Commit
a671ab31
authored
Aug 29, 2011
by
haemmer
Browse files
Made Shibboleth session check more robust
parent
a05cf3a6
Changes
1
Hide whitespace changes
Inline
Side-by-side
templates.php
View file @
a671ab31
...
...
@@ -487,7 +487,7 @@ function isCookie(check_name){
// Query Shibboleth Session handler and process response afterwards
// This method has to be used because HttpOnly prevents reading
// the shib session cookies via JavaScript
function
queryShibSessionHandler
(url){
function
isShibbolethSession
(url){
var xmlhttp;
if (window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest();
...
...
@@ -496,8 +496,13 @@ function queryShibSessionHandler(url){
}
// Send request
xmlhttp.open("GET", url, false);
xmlhttp.send();
try {
xmlhttp.open("GET", url, false);
xmlhttp.send();
} catch (e) {
// Something went wrong, send back false
return false;
}
// Check response code
if (xmlhttp.readyState != 4 || xmlhttp.status != 200 ){
...
...
@@ -524,10 +529,13 @@ function isUserLoggedIn(){
return wayf_check_login_state_function();
} else {
// Use default Shibboleth Service Provider login check
// Check if Shibboleth session cookie exists
var shibSessionCookieExists = isCookie('shibsession');
var shibSessionHandlerShowsSession = queryShibSessionHandler(wayf_sp_handlerURL + '/Session');
// Check if Shibboleth session handler
var shibSessionHandlerShowsSession = isShibbolethSession(wayf_sp_handlerURL + '/Session');
// Return true if one of these checks is succsesful
return (shibSessionCookieExists || shibSessionHandlerShowsSession);
}
}
...
...
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