[PATCH 1 of 2] auth: add https ability to the crowd auth module (issue #315)

Thomas De Schampheleire thomas.de_schampheleire at nokia.com
Wed May 2 06:18:01 UTC 2018


# HG changeset patch
# User Chris Rule <crule at aegistg.com>
# Date 1525187316 -7200
#      Tue May 01 17:08:36 2018 +0200
# Node ID bbdcbac9f5dda7071b951b14b3ffc5c51a303fe5
# Parent  ca4b2c3c2ffbf9d2b518001f9866211e9de8541f
auth: add https ability to the crowd auth module (issue #315)

[Thomas De Schampheleire:
- use select iso checkbox to remove need for bool->string conversion
- update tests]

diff --git a/kallithea/lib/auth_modules/auth_crowd.py b/kallithea/lib/auth_modules/auth_crowd.py
--- a/kallithea/lib/auth_modules/auth_crowd.py
+++ b/kallithea/lib/auth_modules/auth_crowd.py
@@ -131,6 +131,8 @@ class CrowdServer(object):
 
 
 class KallitheaAuthPlugin(auth_modules.KallitheaExternalAuthPlugin):
+    def __init__(self):
+        self._protocol_values = ["http", "https"]
 
     @hybrid_property
     def name(self):
@@ -139,6 +141,14 @@ class KallitheaAuthPlugin(auth_modules.K
     def settings(self):
         settings = [
             {
+                "name": "method",
+                "validator": self.validators.OneOf(self._protocol_values),
+                "type": "select",
+                "values": self._protocol_values,
+                "description": "The protocol used to connect to the Atlassian CROWD server.",
+                "formname": "Protocol"
+            },
+            {
                 "name": "host",
                 "validator": self.validators.UnicodeString(strip=True),
                 "type": "string",
diff --git a/kallithea/tests/functional/test_admin_auth_settings.py b/kallithea/tests/functional/test_admin_auth_settings.py
--- a/kallithea/tests/functional/test_admin_auth_settings.py
+++ b/kallithea/tests/functional/test_admin_auth_settings.py
@@ -229,6 +229,7 @@ class TestAuthSettingsController(TestCon
                        'auth_crowd_app_password': 'secret',
                        'auth_crowd_admin_groups': 'mygroup',
                        'auth_crowd_port': '123',
+                       'auth_crowd_method': 'https',
                        'auth_crowd_app_name': 'xyzzy'})
 
         test_url = url(controller='admin/auth_settings',


More information about the kallithea-general mailing list