openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #03095
[Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
Stefan Rijnhart (Therp) has proposed merging lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools.
Requested reviews:
Server Environment And Tools Core Editors (server-env-tools-core-editors)
For more details, see:
https://code.launchpad.net/~therp-nl/server-env-tools/7.0-auth_from_http_basic/+merge/202316
Still under preparation
--
https://code.launchpad.net/~therp-nl/server-env-tools/7.0-auth_from_http_basic/+merge/202316
Your team Server Environment And Tools Core Editors is requested to review the proposed merge of lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools.
=== added directory 'auth_from_http_basic'
=== added file 'auth_from_http_basic/__init__.py'
--- auth_from_http_basic/__init__.py 1970-01-01 00:00:00 +0000
+++ auth_from_http_basic/__init__.py 2014-01-22 08:33:42 +0000
@@ -0,0 +1,53 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from openerp.addons.web.http import WebRequest, JsonRequest
+from openerp.addons.web.controllers import main as web_main
+
+old_init = WebRequest.init
+
+def init(self, params):
+ old_init(self, params)
+ if self.httprequest.authorization and not self.session._login:
+ dbs = web_main.db_list(self)
+ self.session.authenticate(
+ dbs and dbs[0],
+ self.httprequest.authorization.username,
+ self.httprequest.authorization.password,
+ dict(
+ base_location=self.httprequest.url_root.rstrip('/'),
+ HTTP_HOST=self.httprequest.environ['HTTP_HOST'],
+ REMOTE_ADDR=self.httprequest.environ['REMOTE_ADDR']
+ ))
+
+WebRequest.init = init
+
+old_dispatch = JsonRequest.dispatch
+
+def dispatch(self, method):
+ response = old_dispatch(self, method)
+ if method.im_func == web_main.Session.destroy.im_func:
+ response.status = '301 logout'
+ response.headers.add(
+ 'Location',
+ self.httprequest.url.replace('://', '://logout@'))
+ return response
+
+JsonRequest.dispatch = dispatch
=== added file 'auth_from_http_basic/__openerp__.py'
--- auth_from_http_basic/__openerp__.py 1970-01-01 00:00:00 +0000
+++ auth_from_http_basic/__openerp__.py 2014-01-22 08:33:42 +0000
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+ "name" : "Authenticate via HTTP basic authentication",
+ "version" : "1.0",
+ "author" : "Therp BV",
+ "complexity": "expert",
+ "description": """
+In an environment where several web applications authenticate against the same
+source, the simplest way to attain single sign on would be to have the
+webserver handle authentication and pass the login information via HTTP headers
+to the application it proxies.
+
+This addon allows for this setup. Technically, it picks up the HTTP
+Authorization header, extracts a username and a password and tries to login
+into the first database found in the database list.
+
+If you have to set a specific database, possibly depending on the login
+provided, use the addon dbfilter_from_header.
+
+The addon has to be loaded as server-wide module.
+
+
+Funders:
+
+Open2bizz software & consultancy
+ """,
+ "category" : "",
+ "depends" : [
+ ],
+ "data" : [
+ ],
+ "js": [
+ ],
+ "css": [
+ ],
+ "qweb": [
+ ],
+ "auto_install": False,
+ "installable": True,
+ "external_dependencies" : {
+ 'python' : [],
+ },
+}
=== added directory 'auth_from_http_basic_logout'
=== added file 'auth_from_http_basic_logout/__init__.py'
--- auth_from_http_basic_logout/__init__.py 1970-01-01 00:00:00 +0000
+++ auth_from_http_basic_logout/__init__.py 2014-01-22 08:33:42 +0000
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
=== added file 'auth_from_http_basic_logout/__openerp__.py'
--- auth_from_http_basic_logout/__openerp__.py 1970-01-01 00:00:00 +0000
+++ auth_from_http_basic_logout/__openerp__.py 2014-01-22 08:33:42 +0000
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 of the
+# License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+ "name" : "Authenticate via HTTP basic authentication (logout helper)",
+ "version" : "1.0",
+ "author" : "Therp BV",
+ "complexity": "expert",
+ "description": """
+With auth_from_http_basic, the logout procedure has to be bent a bit to provide
+a good user experience. As the former has to be a server wide module, this is
+the clientside complement which provides the javascript part.
+
+The addon has to be installed in the database in use.
+
+
+Funders:
+
+Open2bizz software & consultancy
+ """,
+ "category" : "",
+ "depends" : [
+ 'web',
+ 'auth_from_http_basic',
+ ],
+ "data" : [
+ ],
+ "js": [
+ 'static/src/js/auth_from_http_basic_logout.js',
+ ],
+ "css": [
+ ],
+ "qweb": [
+ ],
+ "auto_install": False,
+ "installable": True,
+ "external_dependencies" : {
+ 'python' : [],
+ },
+}
=== added directory 'auth_from_http_basic_logout/i18n'
=== added file 'auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot'
--- auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot 1970-01-01 00:00:00 +0000
+++ auth_from_http_basic_logout/i18n/auth_from_http_basic_logout.pot 2014-01-22 08:33:42 +0000
@@ -0,0 +1,23 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-18 16:31+0000\n"
+"PO-Revision-Date: 2014-01-18 16:31+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auth_from_http_basic_logout
+#. openerp-web
+#: code:addons/auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js:37
+#, python-format
+msgid "<p style=\"background: white\">You have been logged out successfully. <a href=\"#\">Click here to log in again.</a></p>"
+msgstr ""
+
=== added file 'auth_from_http_basic_logout/i18n/nl.po'
--- auth_from_http_basic_logout/i18n/nl.po 1970-01-01 00:00:00 +0000
+++ auth_from_http_basic_logout/i18n/nl.po 2014-01-22 08:33:42 +0000
@@ -0,0 +1,23 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 7.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2014-01-18 16:31+0000\n"
+"PO-Revision-Date: 2014-01-18 16:31+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: auth_from_http_basic_logout
+#. openerp-web
+#: code:addons/auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js:37
+#, python-format
+msgid "<p style=\"background: white\">You have been logged out successfully. <a href=\"#\">Click here to log in again.</a></p>"
+msgstr "<p style=\"background: white\">U bent afgemeld. <a href=\"#\">Klik hier om weer in te loggen.</a></p>"
+
=== added directory 'auth_from_http_basic_logout/static'
=== added directory 'auth_from_http_basic_logout/static/src'
=== added directory 'auth_from_http_basic_logout/static/src/img'
=== added file 'auth_from_http_basic_logout/static/src/img/icon.png'
Binary files auth_from_http_basic_logout/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and auth_from_http_basic_logout/static/src/img/icon.png 2014-01-22 08:33:42 +0000 differ
=== added directory 'auth_from_http_basic_logout/static/src/js'
=== added file 'auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js'
--- auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js 1970-01-01 00:00:00 +0000
+++ auth_from_http_basic_logout/static/src/js/auth_from_http_basic_logout.js 2014-01-22 08:33:42 +0000
@@ -0,0 +1,48 @@
+//-*- coding: utf-8 -*-
+//############################################################################
+//
+// OpenERP, Open Source Management Solution
+// This module copyright (C) 2014 Therp BV (<http://therp.nl>).
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero General Public License as
+// published by the Free Software Foundation, either version 3 of the
+// License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+//
+//############################################################################
+
+openerp.auth_from_http_basic_logout = function(openerp)
+{
+ openerp.web.Session.include({
+ session_logout: function()
+ {
+ var deferred = this._super(this, arguments);
+ deferred.fail(function(error, ev)
+ {
+ ev.preventDefault();
+ openerp.web.blockUI();
+ jQuery('.openerp_webclient_container').remove();
+ jQuery('.oe_blockui_spin_container')
+ .empty()
+ .html(
+ _.string.sprintf(
+ openerp.web._t(
+ '<p style="background: white">You have been logged out successfully. <a href="#">Click here to log in again.</a></p>')
+ ))
+ .click(function()
+ {
+ window.location.reload();
+ });
+ });
+ return deferred;
+ }
+ });
+}
Follow ups
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Stefan Rijnhart (Therp), 2014-04-02
-
[Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: noreply, 2014-04-02
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Sylvain LE GAL (GRAP), 2014-04-01
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Sandy Carter (http://www.savoirfairelinux.com), 2014-03-31
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Holger Brunn (Therp), 2014-03-31
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Sandy Carter (http://www.savoirfairelinux.com), 2014-03-14
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Holger Brunn (Therp), 2014-02-07
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Nicolas Bessi - Camptocamp, 2014-02-07
-
Re: [Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Stefan Rijnhart (Therp), 2014-01-22
-
[Merge] lp:~therp-nl/server-env-tools/7.0-auth_from_http_basic into lp:server-env-tools
From: Holger Brunn (Therp), 2014-01-22