Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes | Static Public Attributes
MoinMoin.auth.botbouncer.BotBouncer Class Reference
Inheritance diagram for MoinMoin.auth.botbouncer.BotBouncer:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.auth.botbouncer.BotBouncer:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def login
def request
def logout
def login_hint

Public Attributes

 apikey

Static Public Attributes

string name = 'botbouncer'
list login_inputs = []
 logout_possible = False

Detailed Description

Definition at line 12 of file botbouncer.py.


Constructor & Destructor Documentation

def MoinMoin.auth.botbouncer.BotBouncer.__init__ (   self,
  apikey 
)

Definition at line 15 of file botbouncer.py.

00015 
00016     def __init__(self, apikey):
00017         BaseAuth.__init__(self)
00018         self.apikey = apikey


Member Function Documentation

def MoinMoin.auth.botbouncer.BotBouncer.login (   self,
  request,
  user_obj,
  kw 
)

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 19 of file botbouncer.py.

00019 
00020     def login(self, request, user_obj, **kw):
00021         if kw.get('multistage'):
00022             uid = request.session.get('botbouncer.uid', None)
00023             if not uid:
00024                 return CancelLogin(None)
00025             openid = request.session['botbouncer.id']
00026             del request.session['botbouncer.id']
00027             del request.session['botbouncer.uid']
00028             user_obj = user.User(request, uid, auth_method='openid',
00029                                  auth_username=openid)
00030 
00031         if not user_obj or not user_obj.valid:
00032             return ContinueLogin(user_obj)
00033 
00034         if user_obj.auth_method != 'openid':
00035             return ContinueLogin(user_obj)
00036 
00037         openid_id = user_obj.auth_username
00038 
00039         _ = request.getText
00040 
00041         try:
00042             url = "http://botbouncer.com/api/info?openid=%s&api_key=%s" % (
00043                            quote_plus(openid_id), self.apikey)
00044             data = urlopen(url).read().strip()
00045         except IOError:
00046             return CancelLogin(_('Could not contact botbouncer.com.'))
00047 
00048         data = data.split(':')
00049         if len(data) != 2 or data[0] != 'verified':
00050             return CancelLogin('botbouncer.com verification failed, probably invalid API key.')
00051 
00052         if data[1].lower() == 'true':
00053             # they proved they are human already
00054             return ContinueLogin(user_obj)
00055 
00056         # tell them to verify at bot bouncer first
00057         request.session['botbouncer.id'] = openid_id
00058         request.session['botbouncer.uid'] = user_obj.id
00059 
00060         goto = "http://botbouncer.com/captcha/queryuser?return_to=%%return_form&openid=%s" % (
00061             quote_plus(request.session['botbouncer.id']))
00062         return MultistageRedirectLogin(goto)
def MoinMoin.auth.BaseAuth.login_hint (   self,
  request 
) [inherited]

Reimplemented in MoinMoin.auth.openidrp.OpenIDAuth, and MoinMoin.auth.MoinAuth.

Definition at line 213 of file __init__.py.

00213 
00214     def login_hint(self, request):
00215         return None

def MoinMoin.auth.BaseAuth.logout (   self,
  request,
  user_obj,
  kw 
) [inherited]

Reimplemented in MoinMoin.auth.cas.CASAuth, MoinMoin.auth.smb_mount.SMBMount, and MoinMoin.auth.log.AuthLog.

Definition at line 208 of file __init__.py.

00208 
00209     def logout(self, request, user_obj, **kw):
00210         if self.name and user_obj and user_obj.auth_method == self.name:
00211             logging.debug("%s: logout - invalidating user %r" % (self.name, user_obj.name))
00212             user_obj.valid = False
        return user_obj, True
def MoinMoin.auth.BaseAuth.request (   self,
  request,
  user_obj,
  kw 
) [inherited]

Member Data Documentation

Definition at line 17 of file botbouncer.py.

list MoinMoin.auth.BaseAuth.login_inputs = [] [static, inherited]
MoinMoin.auth.BaseAuth.logout_possible = False [static, inherited]
string MoinMoin.auth.botbouncer.BotBouncer.name = 'botbouncer' [static]

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 13 of file botbouncer.py.


The documentation for this class was generated from the following file: