diff options
author | Petr Vobornik <pvoborni@redhat.com> | 2014-02-14 19:04:15 +0100 |
---|---|---|
committer | Petr Vobornik <pvoborni@redhat.com> | 2014-04-15 12:41:54 +0200 |
commit | 2ec5d969a27b91b04a2b424d93800e68a77aa6e8 (patch) | |
tree | 3612c17faded5dccf70d9c1d755b1fa96e34fa85 /install/ui/src/freeipa/rpc.js | |
parent | 7c068f036f64b3b5156862fc2fc5855db612ef2e (diff) | |
download | freeipa-2ec5d969a27b91b04a2b424d93800e68a77aa6e8.tar.gz freeipa-2ec5d969a27b91b04a2b424d93800e68a77aa6e8.tar.xz freeipa-2ec5d969a27b91b04a2b424d93800e68a77aa6e8.zip |
webui: authentication module
General purpose authentication interface and state. See doc of 'freeipa/auth' module.
https://fedorahosted.org/freeipa/ticket/3903
Reviewed-By: Adam Misnyovszki <amisnyov@redhat.com>
Diffstat (limited to 'install/ui/src/freeipa/rpc.js')
-rw-r--r-- | install/ui/src/freeipa/rpc.js | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/install/ui/src/freeipa/rpc.js b/install/ui/src/freeipa/rpc.js index bd5184650..6bb0ea228 100644 --- a/install/ui/src/freeipa/rpc.js +++ b/install/ui/src/freeipa/rpc.js @@ -23,12 +23,13 @@ */ define([ - 'dojo/_base/lang', + 'dojo/_base/lang', + './auth', './ipa', './text', 'exports' ], - function(lang, IPA, text, rpc /*exports*/) { + function(lang, auth, IPA, text, rpc /*exports*/) { /** * Call an IPA command over JSON-RPC. @@ -206,19 +207,12 @@ rpc.command = function(spec) { dialog.open(); } - function auth_dialog_open(xhr, text_status, error_thrown) { + function error_handler_auth(xhr, text_status, error_thrown) { - var ajax = this; - - var dialog = IPA.unauthorized_dialog({ - xhr: xhr, - text_status: text_status, - error_thrown: error_thrown, - close_on_escape: false, - command: that + auth.current.set_authenticated(false, ''); + auth.current.authenticate().then(function() { + that.execute(); }); - - dialog.open(); } /* @@ -259,7 +253,7 @@ rpc.command = function(spec) { IPA.hide_activity_icon(); if (xhr.status === 401) { - auth_dialog_open(xhr, text_status, error_thrown); + error_handler_auth(xhr, text_status, error_thrown); return; } else if (!error_thrown) { error_thrown = { @@ -281,13 +275,14 @@ rpc.command = function(spec) { error_thrown.message = error_msg; } - // global specical cases error handlers section + // global special cases error handlers section // With trusts, user from trusted domain can use his ticket but he - // doesn't have rights for LDAP modify. It will throw internal errror. + // doesn't have rights for LDAP modify. It will throw internal error. // We should offer form base login. - if (xhr.status === 500 && IPA.ui.logged_kerberos && !IPA.ui.initialized) { - auth_dialog_open(xhr, text_status, error_thrown); + if (xhr.status === 500 && auth.authenticated_by === 'kerberos' && + !IPA.ui.initialized) { + error_handler_auth(xhr, text_status, error_thrown); return; } |