Back to index

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

List of all members.

Public Member Functions

def __init__
def request
def login
def logout
def login_hint

Public Attributes

 autocreate
 realm
 coding

Static Public Attributes

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

Detailed Description

authenticate via http (basic) auth 

Definition at line 56 of file http.py.


Constructor & Destructor Documentation

def MoinMoin.auth.http.HTTPAuthMoin.__init__ (   self,
  autocreate = False,
  realm = 'MoinMoin',
  coding = 'iso-8859-1' 
)

Definition at line 60 of file http.py.

00060 
00061     def __init__(self, autocreate=False, realm='MoinMoin', coding='iso-8859-1'):
00062         self.autocreate = autocreate
00063         self.realm = realm
00064         self.coding = coding
00065         BaseAuth.__init__(self)


Member Function Documentation

def MoinMoin.auth.BaseAuth.login (   self,
  request,
  user_obj,
  kw 
) [inherited]
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.http.HTTPAuthMoin.request (   self,
  request,
  user_obj,
  kw 
)

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 66 of file http.py.

00066 
00067     def request(self, request, user_obj, **kw):
00068         u = None
00069         _ = request.getText
00070         # always revalidate auth
00071         if user_obj and user_obj.auth_method == self.name:
00072             user_obj = None
00073         # something else authenticated before us
00074         if user_obj:
00075             return user_obj, True
00076 
00077         auth = request.authorization
00078         if auth and auth.username and auth.password is not None:
00079             logging.debug("http basic auth, received username: %r password: %r" % (
00080                           auth.username, auth.password))
00081             u = user.User(request,
00082                           name=auth.username.decode(self.coding),
00083                           password=auth.password.decode(self.coding),
00084                           auth_method=self.name, auth_attribs=[])
00085             logging.debug("user: %r" % u)
00086 
00087         if not u or not u.valid:
00088             from werkzeug import Response, abort
00089             response = Response(_('Please log in first.'), 401,
00090                                 {'WWW-Authenticate': 'Basic realm="%s"' % self.realm})
00091             abort(response)
00092 
00093         logging.debug("u: %r" % u)
00094         if u and self.autocreate:
00095             logging.debug("autocreating user")
00096             u.create_or_update()
00097         if u and u.valid:
00098             logging.debug("returning valid user %r" % u)
00099             return u, True # True to get other methods called, too
00100         else:
00101             logging.debug("returning %r" % user_obj)
00102             return user_obj, True
00103 

Member Data Documentation

Definition at line 61 of file http.py.

Definition at line 63 of file http.py.

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

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 58 of file http.py.

Definition at line 62 of file http.py.


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