Added some documentation and a license
authorChris Williams <chris@nitron.org>
Wed, 18 Mar 2009 00:10:12 +0000 (20:10 -0400)
committerChris Williams <chris@nitron.org>
Wed, 18 Mar 2009 00:10:12 +0000 (20:10 -0400)
LICENSE [new file with mode: 0644]
README
cas_provider/management/commands/cleanuptickets.py

diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..ec58004
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,28 @@
+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.
diff --git a/README b/README
index 4cc70b3..2568ad0 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,27 @@
 django-cas-provider
 django-cas-provider
-
 Chris Williams <chris@nitron.org>
 
 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).
+
index 751e220..772fdcb 100644 (file)
@@ -13,13 +13,23 @@ from django.conf import settings
 
 import datetime
 
 
 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):
 
 class Command(NoArgsCommand):
     help = "Delete expired service tickets from the database"
 
     def handle_noargs(self, **options):
+        print "Service tickets:"
         tickets = ServiceTicket.objects.all()
         tickets = ServiceTicket.objects.all()
+        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
+        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:
         for ticket in tickets:
             expiration = datetime.timedelta(minutes=settings.CAS_TICKET_EXPIRATION)
             if datetime.datetime.now() > ticket.created + expiration: