From: Chris Williams Date: Wed, 18 Mar 2009 00:10:12 +0000 (-0400) Subject: Added some documentation and a license X-Git-Tag: 22.4~72 X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/commitdiff_plain/788f43bed3a5919a533d7e963f5729633a9c3197?hp=6230f9685faacd085caa15b24ec73d8609070283 Added some documentation and a license --- diff --git a/LICENSE b/LICENSE new file mode 100644 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 --- a/README +++ b/README @@ -1,5 +1,27 @@ django-cas-provider - Chris Williams -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). + diff --git a/cas_provider/management/commands/cleanuptickets.py b/cas_provider/management/commands/cleanuptickets.py index 751e220..772fdcb 100644 --- a/cas_provider/management/commands/cleanuptickets.py +++ b/cas_provider/management/commands/cleanuptickets.py @@ -13,13 +13,23 @@ from django.conf import settings 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) + 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: