summaryrefslogtreecommitdiffstats
path: root/swiftkerbauth/__init__.py
diff options
context:
space:
mode:
authorPrashanth Pai <ppai@redhat.com>2013-11-06 17:30:28 +0530
committerLuis Pabon <lpabon@redhat.com>2013-11-17 16:34:11 -0800
commit991989bc04178442b2a6b766a67f7a26e60c08f0 (patch)
treee796215fbb45333290fdd293b608235b7f67493c /swiftkerbauth/__init__.py
parentf64a3354185f32928e2568d9ece4a52fa4746c05 (diff)
Modularize swift-auth CGI script, add unit tests
- Moved most of swift-auth CGI script to kerbauth_utils.py - Added unit tests for kerbauth_utils.py - Made MEMCACHE_SERVERS, DEBUG_HEADERS, TOKEN_LIFE as configurable parameters Change-Id: I2e9e9823e8aa99dc2cf41327c55428350c8768dc Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/6248 Tested-by: Chetan Risbud <crisbud@redhat.com> Reviewed-by: Chetan Risbud <crisbud@redhat.com> Reviewed-by: Luis Pabon <lpabon@redhat.com> Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'swiftkerbauth/__init__.py')
-rw-r--r--swiftkerbauth/__init__.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/swiftkerbauth/__init__.py b/swiftkerbauth/__init__.py
index eaa1d88..abdbeaa 100644
--- a/swiftkerbauth/__init__.py
+++ b/swiftkerbauth/__init__.py
@@ -14,4 +14,23 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-__version__ = "1.0.0"
+
+from swift.common.utils import readconf, config_true_value
+
+config_file = {}
+try:
+ config_file = readconf("/etc/swift/proxy-server.conf",
+ section_name="filter:cache")
+except SystemExit:
+ pass
+MEMCACHE_SERVERS = config_file.get('memcache_servers', None)
+
+config_file = {}
+try:
+ config_file = readconf("/etc/swift/proxy-server.conf",
+ section_name="filter:kerbauth")
+except SystemExit:
+ pass
+TOKEN_LIFE = int(config_file.get('token_life', 86400))
+RESELLER_PREFIX = config_file.get('reseller_prefix', "AUTH_")
+DEBUG_HEADERS = config_true_value(config_file.get('debug_headers', 'yes'))