Back to index

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

List of all members.

Public Member Functions

def __init__
def login
def request
def logout
def login_hint

Public Attributes

 trusted_wikis
 autocreate

Static Public Attributes

string name = 'interwiki'
 logout_possible = True
list login_inputs = ['username', 'password']

Detailed Description

Definition at line 18 of file interwiki.py.


Constructor & Destructor Documentation

def MoinMoin.auth.interwiki.InterwikiAuth.__init__ (   self,
  trusted_wikis,
  autocreate = False 
)

Definition at line 23 of file interwiki.py.

00023 
00024     def __init__(self, trusted_wikis, autocreate=False):
00025         BaseAuth.__init__(self)
00026         self.trusted_wikis = trusted_wikis
00027         self.autocreate = autocreate


Member Function Documentation

def MoinMoin.auth.interwiki.InterwikiAuth.login (   self,
  request,
  user_obj,
  kw 
)

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 28 of file interwiki.py.

00028 
00029     def login(self, request, user_obj, **kw):
00030         username = kw.get('username')
00031         password = kw.get('password')
00032 
00033         if not username or not password:
00034             return ContinueLogin(user_obj)
00035 
00036         logging.debug("trying to authenticate %r" % username)
00037         wikiname, username = username.split(' ', 1) # XXX Hack because ':' is not allowed in name field
00038         wikitag, wikiurl, name, err = wikiutil.resolve_interwiki(request, wikiname, username)
00039 
00040         logging.debug("resolve wiki returned: %r %r %r %r" % (wikitag, wikiurl, name, err))
00041         if err or wikitag not in self.trusted_wikis:
00042             return ContinueLogin(user_obj)
00043 
00044         homewiki = xmlrpclib.ServerProxy(wikiurl + "?action=xmlrpc2")
00045         auth_token = homewiki.getAuthToken(name, password)
00046         if not auth_token:
00047             logging.debug("%r wiki did not return an auth token." % wikitag)
00048             return ContinueLogin(user_obj)
00049 
00050         logging.debug("successfully got an auth token for %r. trying to get user profile data..." % name)
00051 
00052         mc = xmlrpclib.MultiCall(homewiki)
00053         mc.applyAuthToken(auth_token)
00054         mc.getUserProfile()
00055         result, account_data = mc()
00056 
00057         if result != "SUCCESS":
00058             logging.debug("%r wiki did not accept auth token." % wikitag)
00059             return ContinueLogin(None)
00060 
00061         if not account_data:
00062             logging.debug("%r wiki did not return a user profile." % wikitag)
00063             return ContinueLogin(None)
00064 
00065         logging.debug("%r wiki returned a user profile." % wikitag)
00066 
00067         # TODO: check remote auth_attribs
00068         u = user.User(request, name=name, auth_method=self.name, auth_attribs=('name', 'aliasname', 'password', 'email', ))
00069         for key, value in account_data.iteritems():
00070             if key not in request.cfg.user_transient_fields:
00071                 setattr(u, key, value)
00072         u.valid = True
00073         if self.autocreate:
00074             u.create_or_update(True)
00075         logging.debug("successful interwiki auth for %r" % name)
00076         return ContinueLogin(u)
00077 
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 26 of file interwiki.py.

list MoinMoin.auth.interwiki.InterwikiAuth.login_inputs = ['username', 'password'] [static]

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 21 of file interwiki.py.

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 20 of file interwiki.py.

string MoinMoin.auth.interwiki.InterwikiAuth.name = 'interwiki' [static]

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 19 of file interwiki.py.

Definition at line 25 of file interwiki.py.


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