Back to index

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

List of all members.

Public Member Functions

def __init__
def request
def login
def logout
def login_hint

Public Attributes

 use_email
 authorities
 email_key
 name_key
 use_name
 autocreate

Static Public Attributes

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

Detailed Description

authenticate via SSL client certificate 

Definition at line 16 of file sslclientcert.py.


Constructor & Destructor Documentation

def MoinMoin.auth.sslclientcert.SSLClientCertAuth.__init__ (   self,
  authorities = None,
  email_key = True,
  name_key = True,
  use_email = False,
  use_name = False,
  autocreate = False 
)

Definition at line 24 of file sslclientcert.py.

00024 
00025                  autocreate=False):
00026         self.use_email = use_email
00027         self.authorities = authorities
00028         self.email_key = email_key
00029         self.name_key = name_key
00030         self.use_email = use_email
00031         self.use_name = use_name
00032         self.autocreate = autocreate
00033         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.sslclientcert.SSLClientCertAuth.request (   self,
  request,
  user_obj,
  kw 
)

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 34 of file sslclientcert.py.

00034 
00035     def request(self, request, user_obj, **kw):
00036         u = None
00037         changed = False
00038 
00039         env = request.environ
00040         if env.get('SSL_CLIENT_VERIFY', 'FAILURE') == 'SUCCESS':
00041 
00042             # check authority list if given
00043             if self.authorities and env.get('SSL_CLIENT_I_DN_OU') in self.authorities:
00044                 return user_obj, True
00045 
00046             email_lower = None
00047             if self.email_key:
00048                 email = env.get('SSL_CLIENT_S_DN_Email', '').decode(config.charset)
00049                 email_lower = email.lower()
00050             commonname_lower = None
00051             if self.name_key:
00052                 commonname = env.get('SSL_CLIENT_S_DN_CN', '').decode(config.charset)
00053                 commonname_lower = commonname.lower()
00054             if email_lower or commonname_lower:
00055                 for uid in user.getUserList(request):
00056                     u = user.User(request, uid,
00057                                   auth_method=self.name, auth_attribs=())
00058                     if self.email_key and email_lower and u.email.lower() == email_lower:
00059                         u.auth_attribs = ('email', 'password')
00060                         if self.use_name and commonname_lower != u.name.lower():
00061                             u.name = commonname
00062                             changed = True
00063                             u.auth_attribs = ('email', 'name', 'password')
00064                         break
00065                     if self.name_key and commonname_lower and u.name.lower() == commonname_lower:
00066                         u.auth_attribs = ('name', 'password')
00067                         if self.use_email and email_lower != u.email.lower():
00068                             u.email = email
00069                             changed = True
00070                             u.auth_attribs = ('name', 'email', 'password')
00071                         break
00072                 else:
00073                     u = None
00074                 if u is None:
00075                     # user wasn't found, so let's create a new user object
00076                     u = user.User(request, name=commonname_lower, auth_username=commonname_lower,
00077                                   auth_method=self.name)
00078                     u.auth_attribs = ('name', 'password')
00079                     if self.use_email:
00080                         u.email = email
00081                         u.auth_attribs = ('name', 'email', 'password')
00082         elif user_obj and user_obj.auth_method == self.name:
00083             user_obj.valid = False
00084             return user_obj, False
00085         if u and self.autocreate:
00086             u.create_or_update(changed)
00087         if u and u.valid:
00088             return u, True
00089         else:
00090             return user_obj, True

Member Data Documentation

Definition at line 26 of file sslclientcert.py.

Definition at line 31 of file sslclientcert.py.

Definition at line 27 of file sslclientcert.py.

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

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 19 of file sslclientcert.py.

Definition at line 28 of file sslclientcert.py.

Definition at line 25 of file sslclientcert.py.

Definition at line 30 of file sslclientcert.py.


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