1
# django-openid-auth - OpenID integration for django.contrib.auth
3
# Copyright (C) 2007 Simon Willison
4
# Copyright (C) 2008-2009 Canonical Ltd.
6
# Redistribution and use in source and binary forms, with or without
7
# modification, are permitted provided that the following conditions
10
# * Redistributions of source code must retain the above copyright
11
# notice, this list of conditions and the following disclaimer.
13
# * Redistributions in binary form must reproduce the above copyright
14
# notice, this list of conditions and the following disclaimer in the
15
# documentation and/or other materials provided with the distribution.
17
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
23
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
27
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
# POSSIBILITY OF SUCH DAMAGE.
30
from django.contrib.auth.models import User
31
from django.db import models
34
class Nonce(models.Model):
35
server_url = models.CharField(max_length=2047)
36
timestamp = models.IntegerField()
37
salt = models.CharField(max_length=40)
39
def __unicode__(self):
40
return u"Nonce: %s, %s" % (self.server_url, self.salt)
43
class Association(models.Model):
44
server_url = models.TextField(max_length=2047)
45
handle = models.CharField(max_length=255)
46
secret = models.TextField(max_length=255) # Stored base64 encoded
47
issued = models.IntegerField()
48
lifetime = models.IntegerField()
49
assoc_type = models.TextField(max_length=64)
51
def __unicode__(self):
52
return u"Association: %s, %s" % (self.server_url, self.handle)
55
class UserOpenID(models.Model):
56
user = models.ForeignKey(User)
57
claimed_id = models.TextField(max_length=2047, unique=True)
58
display_id = models.TextField(max_length=2047)