Back to index

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

List of all members.

Public Member Functions

def __init__
def request
def logout
def login
def login_hint

Public Attributes

 cas

Static Public Attributes

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

Detailed Description

handle login from CAS 

Definition at line 65 of file cas.py.


Constructor & Destructor Documentation

def MoinMoin.auth.cas.CASAuth.__init__ (   self,
  auth_server,
  login_path = "/login",
  logout_path = "/logout",
  validate_path = "/validate" 
)

Definition at line 71 of file cas.py.

00071 
00072     def __init__(self, auth_server, login_path="/login", logout_path="/logout", validate_path="/validate"):
00073         BaseAuth.__init__(self)
00074         self.cas = PyCAS(auth_server, login_path=login_path,
00075                          validate_path=validate_path, logout_path=logout_path)


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.cas.CASAuth.logout (   self,
  request,
  user_obj,
  kw 
)

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 113 of file cas.py.

00113 
00114     def logout(self, request, user_obj, **kw):
00115         if self.name and user_obj and user_obj.auth_method == self.name:
00116             url = request.getBaseURL() + urllib.quote_plus(request.getPathinfo().encode('utf-8'))
00117             request.http_redirect(self.cas.logout_url(url))
00118 
00119             user_obj.valid = False
00120 
00121         return user_obj, True
00122 
def MoinMoin.auth.cas.CASAuth.request (   self,
  request,
  user_obj,
  kw 
)

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 76 of file cas.py.

00076 
00077     def request(self, request, user_obj, **kw):
00078         ticket = request.args.get('ticket')
00079         action = request.args.get("action", [])
00080         logoutRequest = request.args.get('logoutRequest', [])
00081         url = request.getBaseURL() + urllib.quote_plus(request.getPathinfo().encode('utf-8'))
00082 
00083         # # handle logout request from CAS
00084         # if logoutRequest:
00085             # logoutRequestMatch = re.search("<samlp:SessionIndex>(.*)</samlp:SessionIndex>", logoutRequest[0])
00086             # service_ticket = logoutRequestMatch.group(1)
00087             # if service_ticket:
00088                 # # TODO: logout
00089                 # return self.logout(request, user_obj)
00090 
00091         # authenticated user
00092         if user_obj and user_obj.valid:
00093             return user_obj, True
00094 
00095         # anonymous
00096         if not ticket and not "login" in action:
00097             return user_obj, True
00098 
00099         # valid ticket on CAS
00100         if ticket:
00101             valid, username = self.cas.validate_ticket(url, ticket[0])
00102             if valid:
00103                 u = user.User(request, auth_username=username, auth_method=self.name)
00104                 u.valid = valid
00105                 # auto create user
00106                 u.create_or_update(True)
00107                 return u, True
00108 
00109         # login
00110         request.http_redirect(self.cas.login_url(url))
00111 
00112         return user_obj, True


Member Data Documentation

Definition at line 73 of file cas.py.

list MoinMoin.auth.cas.CASAuth.login_inputs = ['username', 'password'] [static]

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 68 of file cas.py.

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 69 of file cas.py.

string MoinMoin.auth.cas.CASAuth.name = 'CAS' [static]

Reimplemented from MoinMoin.auth.BaseAuth.

Definition at line 67 of file cas.py.


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