+++ /dev/null
-# -*- coding: utf-8 -*-
-"""cas_provider.exceptions -- exceptions defined for CAS login workflows
-"""
-from __future__ import unicode_literals
-
-
-class SameEmailMismatchedPasswords(Exception): pass
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
('ticket', models.CharField(max_length=32, verbose_name='ticket')),
('created', models.DateTimeField(auto_now=True, verbose_name='created')),
- ('proxyGrantingTicket', models.ForeignKey(verbose_name='Proxy Granting Ticket', to='cas_provider.ProxyGrantingTicket')),
+ ('proxyGrantingTicket', models.ForeignKey(verbose_name='Proxy Granting Ticket', to='cas_provider.ProxyGrantingTicket', on_delete=models.CASCADE)),
],
options={
'verbose_name': 'Proxy Granting Ticket IOU',
migrations.CreateModel(
name='ProxyTicket',
fields=[
- ('serviceticket_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cas_provider.ServiceTicket')),
- ('proxyGrantingTicket', models.ForeignKey(verbose_name='Proxy Granting Ticket', to='cas_provider.ProxyGrantingTicket')),
+ ('serviceticket_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='cas_provider.ServiceTicket', on_delete=models.CASCADE)),
+ ('proxyGrantingTicket', models.ForeignKey(verbose_name='Proxy Granting Ticket', to='cas_provider.ProxyGrantingTicket', on_delete=models.CASCADE)),
],
options={
'verbose_name': 'Proxy Ticket',
migrations.AddField(
model_name='serviceticket',
name='user',
- field=models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL),
+ field=models.ForeignKey(verbose_name='user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
model_name='proxygrantingticket',
name='serviceTicket',
- field=models.ForeignKey(to='cas_provider.ServiceTicket', null=True),
+ field=models.ForeignKey(to='cas_provider.ServiceTicket', null=True, on_delete=models.CASCADE),
preserve_default=True,
),
]
migrations.AddField(
model_name='proxygrantingticket',
name='pgt',
- field=models.ForeignKey(to='cas_provider.ProxyGrantingTicket', null=True),
+ field=models.ForeignKey(to='cas_provider.ProxyGrantingTicket', null=True, on_delete=models.CASCADE),
preserve_default=True,
),
migrations.AddField(
migrations.AddField(
model_name='proxygrantingticket',
name='user',
- field=models.ForeignKey(default=0, verbose_name='user', to=settings.AUTH_USER_MODEL),
+ field=models.ForeignKey(default=0, verbose_name='user', to=settings.AUTH_USER_MODEL, on_delete=models.CASCADE),
preserve_default=False,
),
]
class ServiceTicket(BaseTicket):
- user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('user'))
+ user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('user'), on_delete=models.CASCADE)
service = models.URLField(_('service'))
prefix = 'ST'
class ProxyGrantingTicket(BaseTicket):
- user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('user'))
+ user = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_('user'), on_delete=models.CASCADE)
service = models.URLField(_('service'), null=True)
- pgt = models.ForeignKey('self', null=True)
+ pgt = models.ForeignKey('self', null=True, on_delete=models.CASCADE)
pgtiou = models.CharField(max_length=256, verbose_name=_('PGTiou'))
prefix = 'PGT'
class ProxyTicket(ServiceTicket):
- proxyGrantingTicket = models.ForeignKey(ProxyGrantingTicket, verbose_name=_('Proxy Granting Ticket'))
+ proxyGrantingTicket = models.ForeignKey(ProxyGrantingTicket, verbose_name=_('Proxy Granting Ticket'), on_delete=models.CASCADE)
prefix = 'PT'
class ProxyGrantingTicketIOU(BaseTicket):
- proxyGrantingTicket = models.ForeignKey(ProxyGrantingTicket, verbose_name=_('Proxy Granting Ticket'))
+ proxyGrantingTicket = models.ForeignKey(ProxyGrantingTicket, verbose_name=_('Proxy Granting Ticket'), on_delete=models.CASCADE)
prefix = 'PGTIOU'
+++ /dev/null
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Adding model 'ServiceTicket'
- db.create_table('cas_provider_serviceticket', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('ticket', self.gf('django.db.models.fields.CharField')(max_length=32)),
- ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
- ('user', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['auth.User'])),
- ('service', self.gf('django.db.models.fields.URLField')(max_length=200)),
- ))
- db.send_create_signal('cas_provider', ['ServiceTicket'])
-
- # Adding model 'LoginTicket'
- db.create_table('cas_provider_loginticket', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('ticket', self.gf('django.db.models.fields.CharField')(max_length=32)),
- ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
- ))
- db.send_create_signal('cas_provider', ['LoginTicket'])
-
-
- def backwards(self, orm):
-
- # Deleting model 'ServiceTicket'
- db.delete_table('cas_provider_serviceticket')
-
- # Deleting model 'LoginTicket'
- db.delete_table('cas_provider_loginticket')
-
-
- models = {
- 'auth.group': {
- 'Meta': {'object_name': 'Group'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
- 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
- },
- 'auth.permission': {
- 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
- 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'auth.user': {
- 'Meta': {'object_name': 'User'},
- 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
- 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
- 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'cas_provider.loginticket': {
- 'Meta': {'object_name': 'LoginTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.serviceticket': {
- 'Meta': {'object_name': 'ServiceTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'service': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
- 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
- },
- 'contenttypes.contenttype': {
- 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
- 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
- }
- }
-
- complete_apps = ['cas_provider']
+++ /dev/null
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Adding model 'ProxyGrantingTicket'
- db.create_table('cas_provider_proxygrantingticket', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('ticket', self.gf('django.db.models.fields.CharField')(max_length=32)),
- ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
- ('serviceTicket', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cas_provider.ServiceTicket'], null=True)),
- ('pgtiou', self.gf('django.db.models.fields.CharField')(max_length=256)),
- ('targetService', self.gf('django.db.models.fields.URLField')(max_length=200)),
- ))
- db.send_create_signal('cas_provider', ['ProxyGrantingTicket'])
-
- # Adding model 'ProxyTicket'
- db.create_table('cas_provider_proxyticket', (
- ('serviceticket_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cas_provider.ServiceTicket'], unique=True, primary_key=True)),
- ('proxyGrantingTicket', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cas_provider.ProxyGrantingTicket'])),
- ))
- db.send_create_signal('cas_provider', ['ProxyTicket'])
-
- # Adding model 'ProxyGrantingTicketIOU'
- db.create_table('cas_provider_proxygrantingticketiou', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('ticket', self.gf('django.db.models.fields.CharField')(max_length=32)),
- ('created', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, blank=True)),
- ('proxyGrantingTicket', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cas_provider.ProxyGrantingTicket'])),
- ))
- db.send_create_signal('cas_provider', ['ProxyGrantingTicketIOU'])
-
-
- def backwards(self, orm):
-
- # Deleting model 'ProxyGrantingTicket'
- db.delete_table('cas_provider_proxygrantingticket')
-
- # Deleting model 'ProxyTicket'
- db.delete_table('cas_provider_proxyticket')
-
- # Deleting model 'ProxyGrantingTicketIOU'
- db.delete_table('cas_provider_proxygrantingticketiou')
-
-
- models = {
- 'auth.group': {
- 'Meta': {'object_name': 'Group'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
- 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
- },
- 'auth.permission': {
- 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
- 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'auth.user': {
- 'Meta': {'object_name': 'User'},
- 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
- 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
- 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'cas_provider.loginticket': {
- 'Meta': {'object_name': 'LoginTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxygrantingticket': {
- 'Meta': {'object_name': 'ProxyGrantingTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'pgtiou': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
- 'serviceTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ServiceTicket']", 'null': 'True'}),
- 'targetService': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxygrantingticketiou': {
- 'Meta': {'object_name': 'ProxyGrantingTicketIOU'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'proxyGrantingTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ProxyGrantingTicket']"}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxyticket': {
- 'Meta': {'object_name': 'ProxyTicket', '_ormbases': ['cas_provider.ServiceTicket']},
- 'proxyGrantingTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ProxyGrantingTicket']"}),
- 'serviceticket_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cas_provider.ServiceTicket']", 'unique': 'True', 'primary_key': 'True'})
- },
- 'cas_provider.serviceticket': {
- 'Meta': {'object_name': 'ServiceTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'service': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
- 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
- },
- 'contenttypes.contenttype': {
- 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
- 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
- }
- }
-
- complete_apps = ['cas_provider']
+++ /dev/null
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
-
- # Deleting field 'ProxyGrantingTicket.targetService'
- db.delete_column('cas_provider_proxygrantingticket', 'targetService')
-
-
- def backwards(self, orm):
-
- # Adding field 'ProxyGrantingTicket.targetService'
- db.add_column('cas_provider_proxygrantingticket', 'targetService', self.gf('django.db.models.fields.URLField')(default='http://not.used', max_length=200), keep_default=False)
-
-
- models = {
- 'auth.group': {
- 'Meta': {'object_name': 'Group'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
- 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
- },
- 'auth.permission': {
- 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
- 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'auth.user': {
- 'Meta': {'object_name': 'User'},
- 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
- 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
- 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'cas_provider.loginticket': {
- 'Meta': {'object_name': 'LoginTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxygrantingticket': {
- 'Meta': {'object_name': 'ProxyGrantingTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'pgtiou': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
- 'serviceTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ServiceTicket']", 'null': 'True'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxygrantingticketiou': {
- 'Meta': {'object_name': 'ProxyGrantingTicketIOU'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'proxyGrantingTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ProxyGrantingTicket']"}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxyticket': {
- 'Meta': {'object_name': 'ProxyTicket', '_ormbases': ['cas_provider.ServiceTicket']},
- 'proxyGrantingTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ProxyGrantingTicket']"}),
- 'serviceticket_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cas_provider.ServiceTicket']", 'unique': 'True', 'primary_key': 'True'})
- },
- 'cas_provider.serviceticket': {
- 'Meta': {'object_name': 'ServiceTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'service': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
- 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
- },
- 'contenttypes.contenttype': {
- 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
- 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
- }
- }
-
- complete_apps = ['cas_provider']
+++ /dev/null
-# -*- coding: utf-8 -*-
-from south.utils import datetime_utils as datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
- # Deleting field 'ProxyGrantingTicket.serviceTicket'
- db.delete_column('cas_provider_proxygrantingticket', 'serviceTicket_id')
-
- # Adding field 'ProxyGrantingTicket.user'
- db.add_column('cas_provider_proxygrantingticket', 'user',
- self.gf('django.db.models.fields.related.ForeignKey')(default=0, to=orm['auth.User']),
- keep_default=False)
-
- # Adding field 'ProxyGrantingTicket.service'
- db.add_column('cas_provider_proxygrantingticket', 'service',
- self.gf('django.db.models.fields.URLField')(max_length=200, null=True),
- keep_default=False)
-
- # Adding field 'ProxyGrantingTicket.pgt'
- db.add_column('cas_provider_proxygrantingticket', 'pgt',
- self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cas_provider.ProxyGrantingTicket'], null=True),
- keep_default=False)
-
-
- def backwards(self, orm):
- # Adding field 'ProxyGrantingTicket.serviceTicket'
- db.add_column('cas_provider_proxygrantingticket', 'serviceTicket',
- self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cas_provider.ServiceTicket'], null=True),
- keep_default=False)
-
- # Deleting field 'ProxyGrantingTicket.user'
- db.delete_column('cas_provider_proxygrantingticket', 'user_id')
-
- # Deleting field 'ProxyGrantingTicket.service'
- db.delete_column('cas_provider_proxygrantingticket', 'service')
-
- # Deleting field 'ProxyGrantingTicket.pgt'
- db.delete_column('cas_provider_proxygrantingticket', 'pgt_id')
-
-
- models = {
- 'auth.group': {
- 'Meta': {'object_name': 'Group'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
- 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
- },
- 'auth.permission': {
- 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
- 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
- },
- 'auth.user': {
- 'Meta': {'object_name': 'User'},
- 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
- 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
- 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
- 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
- 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
- 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
- },
- 'cas_provider.loginticket': {
- 'Meta': {'object_name': 'LoginTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxygrantingticket': {
- 'Meta': {'object_name': 'ProxyGrantingTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'pgt': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ProxyGrantingTicket']", 'null': 'True'}),
- 'pgtiou': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
- 'service': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
- 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
- },
- 'cas_provider.proxygrantingticketiou': {
- 'Meta': {'object_name': 'ProxyGrantingTicketIOU'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'proxyGrantingTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ProxyGrantingTicket']"}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'})
- },
- 'cas_provider.proxyticket': {
- 'Meta': {'object_name': 'ProxyTicket', '_ormbases': ['cas_provider.ServiceTicket']},
- 'proxyGrantingTicket': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cas_provider.ProxyGrantingTicket']"}),
- 'serviceticket_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cas_provider.ServiceTicket']", 'unique': 'True', 'primary_key': 'True'})
- },
- 'cas_provider.serviceticket': {
- 'Meta': {'object_name': 'ServiceTicket'},
- 'created': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'service': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
- 'ticket': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
- 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']"})
- },
- 'contenttypes.contenttype': {
- 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
- 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
- }
- }
-
- complete_apps = ['cas_provider']
from urlparse import parse_qsl, urlparse, urlsplit, urlunsplit
from functools import wraps
+from django import VERSION
from django.utils.decorators import available_attrs
from django.views.decorators.debug import sensitive_post_parameters
from django.views.decorators.cache import cache_control
from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings
from django.contrib.auth import login as auth_login, logout as auth_logout
-from django.core.urlresolvers import get_callable
+
from django.shortcuts import render
from django.utils.translation import ugettext as _
from django.template import RequestContext
from django.contrib.auth import authenticate
-from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from lxml import etree
from . import signals
+if VERSION >= (1, 10):
+ from django.urls import get_callable, reverse
+ user_is_authenticated = lambda user: user.is_authenticated
+else:
+ from django.core.urlresolvers import get_callable, reverse
+ user_is_authenticated = lambda user: user.is_authenticated()
+
__all__ = ['login', 'validate', 'logout', 'service_validate']
INVALID_TICKET = 'INVALID_TICKET'
else:
form = LoginForm(initial={'service': service})
- if user is not None and user.is_authenticated():
+ if user is not None and user_is_authenticated(user):
# We have an authenticated user.
if not user.is_active:
errors.append(_('This account is disabled. Please contact us if you feel it should be enabled again.'))
def logout(request, template_name='cas/logout.html',
auto_redirect=settings.CAS_AUTO_REDIRECT_AFTER_LOGOUT):
url = request.GET.get('url', None)
- if request.user.is_authenticated():
+ if user_is_authenticated(request.user):
for ticket in ServiceTicket.objects.filter(user=request.user):
ticket.delete()
auth_logout(request)
# Django settings for xxx project.
DEBUG = True
-TEMPLATE_DEBUG = DEBUG
ADMINS = (
# ('Your Name', 'your_email@example.com'),
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
- 'NAME': os.path.join(os.path.realpath(__file__), 'db'),
+ 'NAME': os.path.join(os.path.dirname(os.path.realpath(__file__)), 'db'),
}
}
# Examples: "http://media.lawrence.com/media/", "http://example.com/media/"
MEDIA_URL = ''
+# Allow SHA1, because it's used in the fixture.
+PASSWORD_HASHERS = [
+ 'django.contrib.auth.hashers.SHA1PasswordHasher',
+]
+
# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Make this unique, and don't share it with anybody.
SECRET_KEY = 'kv*6pmkq47crqskw%wkst!h7xnisy78zzli@rtklgm#y6o=of!'
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
-# 'django.template.loaders.eggs.Loader',
-)
-
-MIDDLEWARE_CLASSES = (
+MIDDLEWARE = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
)
+# For Django < 1.10
+MIDDLEWARE_CLASSES = MIDDLEWARE
+
+
ROOT_URLCONF = 'simple.urls'
import os
PROJECT_PATH = os.path.abspath(os.path.dirname(__file__))
-TEMPLATE_DIRS = (
- os.path.join(PROJECT_PATH, 'templates'),
-)
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'APP_DIRS': True,
+ 'DIRS': [
+ os.path.join(PROJECT_PATH, 'templates'),
+ ],
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ }
+]
INSTALLED_APPS = (
'django.contrib.admin',
'simple',
)
-if VERSION < (1, 7):
- INSTALLED_APPS += ('south',)
-
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
from cas_provider.signals import cas_collect_custom_attributes
from cas_provider.views import _cas2_sucess_response, INVALID_TICKET, _cas2_error_response, generate_proxy_granting_ticket
from django.contrib.auth.models import User, UserManager
-from django.core.urlresolvers import reverse
from django.test import TestCase
from django.conf import settings
+from django import VERSION
+
try:
from urllib.parse import urlparse, parse_qsl, parse_qs
from urllib2 import install_opener
+if VERSION >= (1, 10):
+ from django.urls import reverse
+ user_is_anonymous = lambda user: user.is_anonymous
+else:
+ from django.core.urlresolvers import reverse
+ user_is_anonymous = lambda user: user.is_anonymous()
class DummyOpener(object):
response = self.client.get(reverse('cas_login'), follow=False)
self.assertEqual(response.status_code, 302)
- self.assertTrue(response['location'].startswith('http://testserver/'))
+ self.assertTrue(response['location'].startswith('http://testserver/' if VERSION < (1, 9) else '/'))
response = self.client.get(response['location'], follow=False)
self.assertIn(response.status_code, [302, 200])
response = self.client.get(reverse('cas_login'), follow=False)
self.assertEqual(response.status_code, 200)
- self.assertEqual(response.context['user'].is_anonymous(), True)
+ self.assertEqual(user_is_anonymous(response.context['user']), True)
def test_broken_pwd(self):
from django.conf.urls import include, url
from django.contrib import admin
from django.views.generic import TemplateView
+from django import VERSION
+
+if VERSION >= (2,):
+ from django.urls import path
urlpatterns = [
- url(r'^admin/', include(admin.site.urls)),
+ url(r'^admin/', include(admin.site.urls)) if VERSION < (2,) else path('admin/', admin.site.urls),
url(r'^', include('cas_provider.urls')),
url(r'^accounts/profile', TemplateView.as_view(template_name='login-success-redirect-target.html')),
]
[tox]
envlist=clear,
- d1{5,6}-py{27},
- d{17,18}-py{27,34},
+ d18-py{27,34},
d{19,110}-py{27,34,35},
d111-py{27,34,35,36,37},
d20-py{34,35,36,37},
[testenv]
commands=coverage run --source=cas_provider --append --branch cas_provider_examples/manage.py test simple
deps=
- d15: Django>=1.5,<1.6
- d16: Django>=1.6,<1.7
- d17: Django>=1.7,<1.8
d18: Django>=1.8,<1.9
d19: Django>=1.9,<1.10
d110: Django>=1.10,<1.11
d21: Django>=2.1,<2.2
d15,d16: https://bitbucket.org/andrewgodwin/south/get/e2c9102ee033.zip
coverage
+usedevelop=True
[testenv:clear]
commands=coverage erase