summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Zorko <robertz@gurucue.com>2015-10-15 14:41:34 +0200
committerRobert Zorko <robertz@gurucue.com>2015-10-15 14:41:34 +0200
commitfeb87a34e3b195d7c204f5d017e108f4f46498e0 (patch)
tree70cb9c1c8d18ef0797f110fbdd6fc8a2357b2ec7
parent9e75e05583b9ae07e86438c63bcc2dc22be05fea (diff)
added the web logic for the saml login, but it still needs testing
-rw-r--r--index.html2
-rw-r--r--js/codeq/aaiLogin.js32
-rw-r--r--js/codeq/comms.js4
3 files changed, 35 insertions, 3 deletions
diff --git a/index.html b/index.html
index 31e6540..f34e1bc 100644
--- a/index.html
+++ b/index.html
@@ -149,7 +149,7 @@
</div>
<div class="container">
<div class="row" style="padding: 0; padding-top: 5px;">
- <iframe width="100%" height="850px" frameborder="0" scrolling="no" allowtransparency="true" src="https://codeq.si/Shibboleth.sso/Login?forceAuthn=1"></iframe>
+ <iframe width="100%" height="850px" frameborder="0" scrolling="no" allowtransparency="true" src="https://codeq.si/Shibboleth.sso/Login?forceAuthn=1" id="aai_iframe"></iframe>
</div>
</div>
</div>
diff --git a/js/codeq/aaiLogin.js b/js/codeq/aaiLogin.js
index e6e36ab..6ea49ea 100644
--- a/js/codeq/aaiLogin.js
+++ b/js/codeq/aaiLogin.js
@@ -5,26 +5,54 @@
var jqNavBarRight = $('.nav.navbar-nav.navbar-right'),
jqNavigationHomeBtn = $('#navigation-home'),
- jqCancelAaiLogin = $("#cancel_aai_login");
+ jqCancelAaiLogin = $("#cancel_aai_login"),
+ jqDisabledOverlay = $('#disabled'),
+ jqAaiIframe = $('#aai_iframe'),
+ baseSamlUrl = 'https://codeq.si/Shibboleth.sso/Login?sid=',
+ samlLoginUrl = '';
codeq.globalStateMachine.register('aailogin',{
'enter': function(){
+ jqDisabledOverlay.css('display', '');
+
+ samlLoginUrl = baseSamlUrl + codeq.comms.getSid();
+ jqAaiIframe.attr('src', samlLoginUrl);
+
jqNavigationHomeBtn.off('click');//remove the click listener of this element here
jqNavBarRight.css('display','none');//hide settings etc.
+ //enable the back button
jqCancelAaiLogin.on('click',function(){
codeq.globalStateMachine.transition('login');
});
$('#signed-in-title').html('');
$('#screen_aai_login').css('display','');
+
+ codeq.comms.samlLogin()
+ .then(function(data){
+ codeq.log.debug(JSON.stringify(data));
+ if(data.code !== 0) throw new Error('SAML login failed, code: ' + data.code + ', message: ' + data.message);
+ codeq.globalStateMachine.transition('language');
+ })
+ .fail(function(reason){
+ codeq.log.error('SAML login failed: ' + reason);
+ alert('SAML login failed: ' + reason);
+ })
+ .done();
+
+ jqDisabledOverlay.css('display','none');
},
'exit' : function(){
//disable site specific listeners
+ codeq.comms.off('saml_login');
+ jqAaiIframe.attr('src','');//lets remove the url
jqCancelAaiLogin.off('click');
+ samlLoginUrl = '';
$("#screen_aai_login").css('display', 'none');
- //re-enable the click listener
+
+ //re-enable the click listener of the logo
jqNavigationHomeBtn.on('click', function(e){
codeq.globalStateMachine.transition('language');
e.preventDefault();
diff --git a/js/codeq/comms.js b/js/codeq/comms.js
index e12ffa3..225026b 100644
--- a/js/codeq/comms.js
+++ b/js/codeq/comms.js
@@ -524,6 +524,10 @@
'getResourceTree': function () {
return ajaxGet(ajaxDataPrefix + 'resources.json');
+ },
+
+ 'samlLogin': function(){
+ return this.send({'action':'saml_login'});
}
};
})();