Start of new common auth handler

This commit is contained in:
alexhudson
2008-05-04 17:38:18 +00:00
parent 376dc0d922
commit e0064cc435
5 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -334,7 +334,6 @@ pkgpythonhawkeye_PYTHON = \
src/www/bongo/hawkeye/__init__.py \
src/www/bongo/hawkeye/AgentView.py \
src/www/bongo/hawkeye/AliasView.py \
src/www/bongo/hawkeye/Auth.py \
src/www/bongo/hawkeye/BackupView.py \
src/www/bongo/hawkeye/HawkeyeHandler.py \
src/www/bongo/hawkeye/HawkeyePath.py \
@@ -363,6 +362,7 @@ pkgpythoncommonwebdir = $(pkgpythondir)/commonweb
pkgpythoncommonweb_PYTHON = \
src/www/bongo/commonweb/__init__.py \
src/www/bongo/commonweb/Auth.py \
src/www/bongo/commonweb/HttpError.py \
src/www/bongo/commonweb/ApacheLogHandler.py \
src/www/bongo/commonweb/BongoCookie.py \
+3 -4
View File
@@ -25,8 +25,7 @@ from bongo.commonweb.HttpError import HttpError
import bongo.dragonfly.Auth
import bongo.commonweb.BongoUtil
import bongo.commonweb.BongoSession as BongoSession
import bongo.hawkeye.Auth
import bongo.sundial.Auth
import bongo.commonweb.Auth as Auth
from bongo.hawkeye.HawkeyePath import HawkeyePath
from bongo.sundial.SundialPath import SundialPath
from bongo.external.simplejson import loads, dumps
@@ -190,7 +189,7 @@ class DragonflyHandler(SimpleHTTPRequestHandler):
if handler.NeedsAuth(rp):
req.log.debug("Yup!")
auth = bongo.hawkeye.Auth.authenhandler(req)
auth = Auth.authenhandler(req)
if auth != bongo.commonweb.HTTP_OK:
target = "/admin/login"
self.send_response(bongo.commonweb.BongoUtil.redirect(req, target))
@@ -259,7 +258,7 @@ class DragonflyHandler(SimpleHTTPRequestHandler):
self.send_error(bongo.commonweb.HTTP_UNAUTHORIZED)
return bongo.commonweb.HTTP_UNAUTHORIZED
else:
auth = bongo.sundial.Auth.authenhandler(req)
auth = Auth.authenhandler(req)
req.log.debug("request for %s (handled by %s)", req.uri, handler)
@@ -1,5 +1,5 @@
import bongo.dragonfly.Auth
from bongo.store.StoreClient import StoreClient
import bongo.commonweb
import bongo.commonweb.BongoSession as BongoSession
import time
+4 -4
View File
@@ -2,7 +2,7 @@ import bongo.commonweb
import os
import bongo.commonweb.BongoUtil
from HawkeyeHandler import HawkeyeHandler
import bongo.hawkeye.Auth as Auth
import bongo.commonweb.Auth as Auth
from libbongo.libs import msgapi
AuthMode = 0
@@ -42,12 +42,12 @@ class RootHandler(HawkeyeHandler):
# check ram free
cm = self.memory("MemTotal:")
used = cm - self.memory("MemFree:") - self.memory("Buffers:") - self.memory("Cached:")
used = used / (1024*1024)
cm = cm / (1024*1024)
used = used / (1024*1024)
cm = cm / (1024*1024)
self.SetVariable("mem", str(round(used, 2)) + "MB / " + str(round(cm, 2)) + "MB")
# check system load
(rqmin1, rqmin5, rqmin15) = os.getloadavg()
recent_av = (rqmin1 + rqmin5) / 2
recent_av = (rqmin1 + rqmin5) / 2
recent_load = "light"
if recent_av > 0.7:
recent_load = "moderate"
+2 -2
View File
@@ -2,8 +2,8 @@ from bongo.commonweb.ApacheLogHandler import ApacheLogHandler, RequestLogProxy
from HawkeyePath import HawkeyePath
from bongo.commonweb.HttpError import HttpError
import Auth
import bongo.commonweb
import bongo.commonweb.Auth as Auth
import bongo.commonweb.BongoFieldStorage as BongoFieldStorage
import bongo.commonweb.BongoUtil as BongoUtil
import bongo.commonweb.BongoSession as BongoSession
@@ -41,7 +41,7 @@ def handler(req):
if handler.NeedsAuth(rp):
req.log.debug("Yup!")
auth = bongo.hawkeye.Auth.authenhandler(req)
auth = Auth.authenhandler(req)
if auth != bongo.commonweb.HTTP_OK:
target = "/admin/login"
BongoUtil.redirect(req, target)