1. Jay Yu
  2. django-cas-provider

Commits

Chris Williams  committed 788f43b

Added some documentation and a license

  • Participants
  • Parent commits 6230f96
  • Branches master

Comments (0)

Files changed (3)

File LICENSE

View file
  • Ignore whitespace
+Copyright (c) 2009, Chris Williams
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above
+      copyright notice, this list of conditions and the following
+      disclaimer in the documentation and/or other materials provided
+      with the distribution.
+    * Neither the name of the author nor the names of other
+      contributors may be used to endorse or promote products derived
+      from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

File README

View file
  • Ignore whitespace
 django-cas-provider
-
 Chris Williams <chris@nitron.org>
 
-TODO: Write documentation
+OVERVIEW:
+	django-cas-provider is a provider for the Central Authentication 
+Service (http://jasig.org/cas). It allows remote services to authenticate 
+users for the purposes of Single Sign-On (SSO). For example, a user logs into
+a CAS server (provided by django-cas-provider) and can then access other
+services (such as email, calendar, etc) without re-entering her password for
+each service. For more details, see http://www.ja-sig.org/wiki/display/CAS/Home
+and http://en.wikipedia.org/wiki/Single_Sign_On
+
+INSTALLATION:
+	To install, run the following command from this directory:
+
+		python setup.py install
+
+	Or, put cas_provider somewhere on your Python path.
+	
+USAGE:
+	*) Add 'cas_provider' to your INSTALLED_APPS tuple in settings.py.
+	*) In settings.py, set LOGIN_URL to '/cas/login/' and LOGOUT_URL to '/cas/logout/'
+		before they expire. Default: 5 minutes
+	*) In urls.py, put the following line:
+	    (r'^cas/', include('cas_provider.urls')),
+	*) Create login/logout templates (templates/cas/login.html and templates/cas/logout.html).
+

File cas_provider/management/commands/cleanuptickets.py

View file
  • Ignore whitespace
 
 import datetime
 
-from cas_provider.models import ServiceTicket
+from cas_provider.models import ServiceTicket, LoginTicket
 
 class Command(NoArgsCommand):
     help = "Delete expired service tickets from the database"
 
     def handle_noargs(self, **options):
+        print "Service tickets:"
         tickets = ServiceTicket.objects.all()
         for ticket in tickets:
             expiration = datetime.timedelta(minutes=settings.CAS_TICKET_EXPIRATION)
                 print "Deleting %s..." % ticket.ticket
                 ticket.delete()
             else:
+                print "%s not expired..." % ticket.ticket
+        tickets = LoginTicket.objects.all()
+        print "Login tickets:"
+        for ticket in tickets:
+            expiration = datetime.timedelta(minutes=settings.CAS_TICKET_EXPIRATION)
+            if datetime.datetime.now() > ticket.created + expiration:
+                print "Deleting %s..." % ticket.ticket
+                ticket.delete()
+            else:
                 print "%s not expired..." % ticket.ticket