Commits

Anonymous committed 01e112d

Discovery Response

Comments (0)

Files changed (14)

 build
 dist
 app/static/jquery
+app/.fixtures
 #!/bin/bash
 #
-export ACCOUNTS_JS_OP=op.accounts.deb
-export ACCOUNTS_JS_RP=rp.accounts.deb
-export ACCOUNTS_JS_OP_PORT=8004
-export ACCOUNTS_JS_RP_PORT=8005
+export OP=op.accounts.deb
+export RP=rp.accounts.deb
+export OP_PORT=8004
+export RP_PORT=8005
+
+export ACCOUNTS_JS_OP=$OP
+export ACCOUNTS_JS_RP=$RP
+export ACCOUNTS_JS_OP_PORT=$OP_PORT
+export ACCOUNTS_JS_RP_PORT=$RP_PORT
 export ACCOUNTS_JS_OP_CNAME=$ACCOUNTS_JS_OP:$ACCOUNTS_JS_OP_PORT
 export ACCOUNTS_JS_RP_CNAME=$ACCOUNTS_JS_RP:$ACCOUNTS_JS_RP_PORT
 #
 # - south
 #
 if 'test' not in sys.argv:
-    INSTALLED_APPS += ( 'south', )
+#    INSTALLED_APPS += ( 'south', )
     pass
 
 # - mandb 
         {},
         context_instance=template.RequestContext(request),)
 
+
+from accounts.openid.views import OPENID_CONFIGURATION_DISPATHCER
+
 urlpatterns = patterns('',
     # Examples:
     # url(r'^$', 'app.views.home', name='home'),
     # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
 
     # Uncomment the next line to enable the admin:
-    url(r'^.well-known/openid-configuration','accounts.openid.views.openid_conf',name='well-known-openid-configuration'),
+    OPENID_CONFIGURATION_DISPATHCER,
     url(r'^admin/', include(admin.site.urls)),
 
     url(r'^accounts/', include("accounts.urls")),

src/accounts/openid/admin.py

 from django.core.urlresolvers import reverse
 
 from models import *
+from accounts.openid.views import endpoint
+
+import re
 
 ### OpenIDGrantRequest 
 class OpenIDGrantRequestAdmin(admin.ModelAdmin):
         super(OpenIDClientAdminForm ,self).__init__(*args,**kwargs)
         if hasattr(self,'current_request'):
             client_host = entity_id(self.current_request)[:-1]
-            self.fields['host'].initial = client_host  + '/'
+            self.fields['host'].initial = client_host 
             self.fields['response_endpoint'].initial =  ( client_host[:-1] if client_host[-1:] == '/' else client_host ) \
-                                                    + reverse('accounts_openid_response')
+                                                    + reverse('accounts_openid_rp_response')
 
 class OpenIDClientAdmin(admin.ModelAdmin):
     form = OpenIDClientAdminForm
         super(OpenIDServerAdminForm ,self).__init__(*args,**kwargs)
         if hasattr(self,'current_request'):
 
-            host = entity_id(self.current_request)[:-1]
+            host = entity_id(self.current_request)
             
             initial = kwargs.get('initial',{} )
-            self.fields['issuer'].initial = host  + '/'
+            self.fields['issuer'].initial = host  
             self.fields['server_id'].initial = self.fields['issuer'].initial
-            self.fields['authorization_endpoint'].initial = host  +   reverse('accounts_openid_request')
-            self.fields['user_info_endpoint'].initial = host   +  reverse('accounts_openid_userinfo')
-            self.fields['token_endpoint'].initial =  host  +  reverse('accounts_openid_token') 
-            self.fields['check_session_endpoint'].initial =  host  +  reverse('accounts_openid_check_session' )
-            self.fields['end_session_endpoint'].initial = host   +  reverse('accounts_openid_end_session' )
-            self.fields['refresh_session_endpoint'].initial = host   +  reverse('accounts_openid_refresh_session')
-            self.fields['introspection_endpoint'].initial = host   +  reverse('accounts_openid_introspection' )
-            self.fields['registration_endpoint'].initial = host   +  reverse('accounts_openid_registration' ) 
-            self.fields['jwk_document'].initial = "{}"
-            self.fields['scopes_supported'].initial = '[ "openid" ]'
-            self.fields['flows_supported'].initial = '[ "code","implicit" ]'
-            self.fields['iso29115_supported'].initial = "[]"     
-            self.fields['identifiers_supported'].initial = "[]"     
+            
+            for f in self.fields:
+                if re.search('_endpoint$',f):
+                    self.fields[f].initial = endpoint(f,host)
 
 class OpenIDServerAdmin(admin.ModelAdmin):
     form = OpenIDServerAdminForm

src/accounts/openid/fixtures/dev/fixture.openid_openidserver.1.json

+[
+  {
+    "pk": 1, 
+    "model": "openid.openidserver", 
+    "fields": {
+      "x509_encryption_url": "", 
+      "request_object_algs_supported": "", 
+      "acrs_supported": "[]", 
+      "check_id_endpoint": "http://op.accounts.deb:8004/accounts/openid/op/check_id", 
+      "x509_url": "", 
+      "issuer": "http://op.accounts.deb:8004", 
+      "server_id": "http://op.accounts.deb:8004", 
+      "token_endpoint_auth_types_supported": "[\"client_secret_basic\"]", 
+      "refresh_session_endpoint": "http://op.accounts.deb:8004/accounts/openid/op/refresh_session", 
+      "token_endpoint": "http://op.accounts.deb:8004/accounts/openid/op/token", 
+      "version": "3.0", 
+      "token_endpoint_auth_algs_supported": "[\"RS256\"]", 
+      "registration_endpoint": "http://op.accounts.deb:8004/accounts/openid/op/registration", 
+      "jwk_encryption_url": "", 
+      "jwk_url": "", 
+      "scopes_supported": "[\"openid\"]", 
+      "id_token_algs_supported": "", 
+      "userinfo_endpoint": "http://op.accounts.deb:8004/accounts/openid/op/userinfo", 
+      "userinfo_algs_supported": "", 
+      "user_id_types_supported": "[\"pairwise\",\"public\"]", 
+      "response_types_supported": "[\"code\",\"token\",\"id_token\",\"id_token token\",\"code token\",\"code id_token\",\"code id_token token\"]", 
+      "end_session_endpoint": "http://op.accounts.deb:8004/accounts/openid/op/end_session", 
+      "authorization_endpoint": "http://op.accounts.deb:8004/accounts/openid/op/request"
+    }
+  }
+]

src/accounts/openid/migrations/0002_initial.py

+# 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 'OpenIDGrantRequest'
+        db.create_table('openid_openidgrantrequest', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('client_id', self.gf('django.db.models.fields.CharField')(max_length=100)),
+            ('response_type', self.gf('django.db.models.fields.CharField')(default='token', max_length=50)),
+            ('scope', self.gf('django.db.models.fields.CharField')(default='', max_length=50)),
+            ('state', self.gf('django.db.models.fields.CharField')(default='', max_length=100)),
+            ('redirect_uri', self.gf('django.db.models.fields.CharField')(max_length=200)),
+            ('client_obj', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['openid.OpenIDClient'], null=True)),
+            ('display', self.gf('django.db.models.fields.CharField')(default='', max_length=10)),
+            ('prompt', self.gf('django.db.models.fields.CharField')(default='', max_length=10)),
+            ('nonce', self.gf('django.db.models.fields.CharField')(default='', unique=True, max_length=100, db_index=True)),
+            ('dt_created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+        ))
+        db.send_create_signal('openid', ['OpenIDGrantRequest'])
+
+        # Adding model 'OpenIDCheckSessionRequest'
+        db.create_table('openid_openidchecksessionrequest', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('session_obj', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['openid.OpenIDSession'], null=True, blank=True)),
+            ('dt_request', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+            ('response', self.gf('django.db.models.fields.TextField')(default='')),
+            ('is_valid', self.gf('django.db.models.fields.BooleanField')(default=False)),
+        ))
+        db.send_create_signal('openid', ['OpenIDCheckSessionRequest'])
+
+        # Adding model 'OpenIDServer'
+        db.create_table('openid_openidserver', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('server_id', self.gf('django.db.models.fields.CharField')(unique=True, max_length=200, db_index=True)),
+            ('authorization_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200)),
+            ('token_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200)),
+            ('supported_scopes', self.gf('django.db.models.fields.CharField')(default='', max_length=200)),
+            ('version', self.gf('django.db.models.fields.CharField')(default='3.0', max_length=5)),
+            ('issuer', self.gf('django.db.models.fields.CharField')(default='', unique=True, max_length=200, db_index=True, blank=True)),
+            ('check_session_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('end_session_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('introspection_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('refresh_session_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('registration_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('user_info_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('scopes_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('flows_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('iso29115_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('identifiers_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('jwk_document', self.gf('django.db.models.fields.TextField')(default='', null=True, blank=True)),
+        ))
+        db.send_create_signal('openid', ['OpenIDServer'])
+
+        # Adding model 'OpenIDClient'
+        db.create_table('openid_openidclient', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('client_id', self.gf('django.db.models.fields.CharField')(default='201203140215197149860v5qgT', max_length=200)),
+            ('client_secret', self.gf('django.db.models.fields.CharField')(default='20120314021519716458gRaI1S', max_length=100)),
+            ('response_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200)),
+            ('server_obj', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['openid.OpenIDServer'])),
+            ('host', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True)),
+            ('expires_in', self.gf('django.db.models.fields.IntegerField')(default=0)),
+        ))
+        db.send_create_signal('openid', ['OpenIDClient'])
+
+        # Adding model 'OpenID'
+        db.create_table('openid_openid', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('user', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['auth.User'], null=True, blank=True)),
+            ('client_obj', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['openid.OpenIDClient'], null=True, blank=True)),
+            ('openid', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('dt_created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+            ('dt_updated', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+        ))
+        db.send_create_signal('openid', ['OpenID'])
+
+        # Adding model 'OpenIDSession'
+        db.create_table('openid_openidsession', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('code', self.gf('django.db.models.fields.CharField')(default='', max_length=255, db_index=True)),
+            ('access_token', self.gf('django.db.models.fields.CharField')(default='', max_length=255, db_index=True)),
+            ('refresh_token', self.gf('django.db.models.fields.CharField')(default='', max_length=255, db_index=True)),
+            ('token_type', self.gf('django.db.models.fields.CharField')(default='Bearer', max_length=10)),
+            ('state', self.gf('django.db.models.fields.CharField')(default='', max_length=255)),
+            ('scope', self.gf('django.db.models.fields.CharField')(default='', max_length=255)),
+            ('dt_created', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+            ('dt_expire', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2012, 3, 13, 17, 45, 19, 718405))),
+            ('server_obj', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['openid.OpenIDServer'])),
+            ('openid_obj', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['openid.OpenID'])),
+            ('request_obj', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['openid.OpenIDGrantRequest'], unique=True)),
+            ('id_token', self.gf('django.db.models.fields.TextField')()),
+        ))
+        db.send_create_signal('openid', ['OpenIDSession'])
+
+        # Adding model 'OpenIDUserInfo'
+        db.create_table('openid_openiduserinfo', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('user_id', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('given_name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('family_name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('middle_name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('nickname', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('profile', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('picture', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('website', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('email', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('verified', self.gf('django.db.models.fields.BooleanField')(default=False, max_length=255)),
+            ('gender', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('birthday', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('zoneinfo', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('locale', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('phone_number', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('address', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('updated_time', self.gf('django.db.models.fields.DateTimeField')()),
+            ('openid_obj', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['openid.OpenID'], unique=True)),
+        ))
+        db.send_create_signal('openid', ['OpenIDUserInfo'])
+
+        # Adding model 'OpenIDUserInfoRequest'
+        db.create_table('openid_openiduserinforequest', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('dt_request', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+            ('dt_response', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+            ('request', self.gf('django.db.models.fields.TextField')(default='')),
+            ('response', self.gf('django.db.models.fields.TextField')(default='')),
+            ('http_meta', self.gf('django.db.models.fields.TextField')(default='')),
+            ('session_obj', self.gf('django.db.models.fields.related.ForeignKey')(default=None, to=orm['openid.OpenIDSession'], null=True, blank=True)),
+        ))
+        db.send_create_signal('openid', ['OpenIDUserInfoRequest'])
+
+        # Adding model 'OpenIDRegRequest'
+        db.create_table('openid_openidregrequest', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('server_obj', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['openid.OpenIDServer'])),
+            ('type', self.gf('django.db.models.fields.CharField')(default='client_associate', max_length=20)),
+            ('client_id', self.gf('django.db.models.fields.CharField')(default=None, max_length=50, null=True, blank=True)),
+            ('client_secret', self.gf('django.db.models.fields.CharField')(default=None, max_length=100, null=True, blank=True)),
+            ('contact', self.gf('django.db.models.fields.CharField')(default=None, max_length=100, null=True, blank=True)),
+            ('application_type', self.gf('django.db.models.fields.CharField')(default='web', max_length=20)),
+            ('application_name', self.gf('django.db.models.fields.CharField')(default=u'An OpenID Client', max_length=100, null=True, blank=True)),
+            ('logo_url', self.gf('django.db.models.fields.CharField')(default=None, max_length=100, null=True, blank=True)),
+            ('redirect_uri', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
+            ('js_origin_uri', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
+            ('jwk_url', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
+            ('sector_identifier', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
+        ))
+        db.send_create_signal('openid', ['OpenIDRegRequest'])
+
+
+    def backwards(self, orm):
+        
+        # Deleting model 'OpenIDGrantRequest'
+        db.delete_table('openid_openidgrantrequest')
+
+        # Deleting model 'OpenIDCheckSessionRequest'
+        db.delete_table('openid_openidchecksessionrequest')
+
+        # Deleting model 'OpenIDServer'
+        db.delete_table('openid_openidserver')
+
+        # Deleting model 'OpenIDClient'
+        db.delete_table('openid_openidclient')
+
+        # Deleting model 'OpenID'
+        db.delete_table('openid_openid')
+
+        # Deleting model 'OpenIDSession'
+        db.delete_table('openid_openidsession')
+
+        # Deleting model 'OpenIDUserInfo'
+        db.delete_table('openid_openiduserinfo')
+
+        # Deleting model 'OpenIDUserInfoRequest'
+        db.delete_table('openid_openiduserinforequest')
+
+        # Deleting model 'OpenIDRegRequest'
+        db.delete_table('openid_openidregrequest')
+
+
+    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'})
+        },
+        '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'})
+        },
+        'openid.openid': {
+            'Meta': {'object_name': 'OpenID'},
+            'client_obj': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['openid.OpenIDClient']", 'null': 'True', 'blank': 'True'}),
+            'dt_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'dt_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'openid': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
+        },
+        'openid.openidchecksessionrequest': {
+            'Meta': {'object_name': 'OpenIDCheckSessionRequest'},
+            'dt_request': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_valid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'response': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'session_obj': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['openid.OpenIDSession']", 'null': 'True', 'blank': 'True'})
+        },
+        'openid.openidclient': {
+            'Meta': {'object_name': 'OpenIDClient'},
+            'client_id': ('django.db.models.fields.CharField', [], {'default': "'20120314021519734770pLOkDp'", 'max_length': '200'}),
+            'client_secret': ('django.db.models.fields.CharField', [], {'default': "'20120314021519735039pHlXWA'", 'max_length': '100'}),
+            'expires_in': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'host': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'response_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200'}),
+            'server_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDServer']"})
+        },
+        'openid.openidgrantrequest': {
+            'Meta': {'object_name': 'OpenIDGrantRequest'},
+            'client_id': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'client_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDClient']", 'null': 'True'}),
+            'display': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10'}),
+            'dt_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'nonce': ('django.db.models.fields.CharField', [], {'default': "''", 'unique': 'True', 'max_length': '100', 'db_index': 'True'}),
+            'prompt': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10'}),
+            'redirect_uri': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'response_type': ('django.db.models.fields.CharField', [], {'default': "'token'", 'max_length': '50'}),
+            'scope': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50'}),
+            'state': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'})
+        },
+        'openid.openidregrequest': {
+            'Meta': {'object_name': 'OpenIDRegRequest'},
+            'application_name': ('django.db.models.fields.CharField', [], {'default': "u'An OpenID Client'", 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'application_type': ('django.db.models.fields.CharField', [], {'default': "'web'", 'max_length': '20'}),
+            'client_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
+            'client_secret': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'contact': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'js_origin_uri': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'jwk_url': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'logo_url': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'redirect_uri': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'sector_identifier': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'server_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDServer']"}),
+            'type': ('django.db.models.fields.CharField', [], {'default': "'client_associate'", 'max_length': '20'})
+        },
+        'openid.openidserver': {
+            'Meta': {'object_name': 'OpenIDServer'},
+            'authorization_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200'}),
+            'check_session_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'end_session_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'flows_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'identifiers_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'introspection_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'iso29115_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'issuer': ('django.db.models.fields.CharField', [], {'default': "''", 'unique': 'True', 'max_length': '200', 'db_index': 'True', 'blank': 'True'}),
+            'jwk_document': ('django.db.models.fields.TextField', [], {'default': "''", 'null': 'True', 'blank': 'True'}),
+            'refresh_session_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'registration_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'scopes_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'server_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200', 'db_index': 'True'}),
+            'supported_scopes': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200'}),
+            'token_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200'}),
+            'user_info_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'version': ('django.db.models.fields.CharField', [], {'default': "'3.0'", 'max_length': '5'})
+        },
+        'openid.openidsession': {
+            'Meta': {'ordering': "['-dt_created']", 'object_name': 'OpenIDSession'},
+            'access_token': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'db_index': 'True'}),
+            'code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'db_index': 'True'}),
+            'dt_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'dt_expire': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 3, 13, 17, 45, 19, 736075)'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'id_token': ('django.db.models.fields.TextField', [], {}),
+            'openid_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenID']"}),
+            'refresh_token': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'db_index': 'True'}),
+            'request_obj': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['openid.OpenIDGrantRequest']", 'unique': 'True'}),
+            'scope': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
+            'server_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDServer']"}),
+            'state': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
+            'token_type': ('django.db.models.fields.CharField', [], {'default': "'Bearer'", 'max_length': '10'})
+        },
+        'openid.openiduserinfo': {
+            'Meta': {'object_name': 'OpenIDUserInfo'},
+            'address': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'birthday': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'email': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'family_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'gender': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'given_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'locale': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'middle_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'nickname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'openid_obj': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['openid.OpenID']", 'unique': 'True'}),
+            'phone_number': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'picture': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'profile': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'updated_time': ('django.db.models.fields.DateTimeField', [], {}),
+            'user_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'max_length': '255'}),
+            'website': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'zoneinfo': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'openid.openiduserinforequest': {
+            'Meta': {'object_name': 'OpenIDUserInfoRequest'},
+            'dt_request': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'dt_response': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'http_meta': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'request': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'response': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'session_obj': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['openid.OpenIDSession']", 'null': 'True', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['openid']

src/accounts/openid/migrations/0003_auto__del_field_openidserver_introspection_endpoint__del_field_openids.py

+# 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):
+        
+        # Removing unique constraint on 'OpenIDServer', fields ['issuer']
+        db.delete_unique('openid_openidserver', ['issuer'])
+
+        # Deleting field 'OpenIDServer.introspection_endpoint'
+        db.delete_column('openid_openidserver', 'introspection_endpoint')
+
+        # Deleting field 'OpenIDServer.check_session_endpoint'
+        db.delete_column('openid_openidserver', 'check_session_endpoint')
+
+        # Deleting field 'OpenIDServer.identifiers_supported'
+        db.delete_column('openid_openidserver', 'identifiers_supported')
+
+        # Deleting field 'OpenIDServer.user_info_endpoint'
+        db.delete_column('openid_openidserver', 'user_info_endpoint')
+
+        # Deleting field 'OpenIDServer.iso29115_supported'
+        db.delete_column('openid_openidserver', 'iso29115_supported')
+
+        # Deleting field 'OpenIDServer.jwk_document'
+        db.delete_column('openid_openidserver', 'jwk_document')
+
+        # Deleting field 'OpenIDServer.flows_supported'
+        db.delete_column('openid_openidserver', 'flows_supported')
+
+        # Adding field 'OpenIDServer.check_id_endpoint'
+        db.add_column('openid_openidserver', 'check_id_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=400, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.userinfo_endpoint'
+        db.add_column('openid_openidserver', 'userinfo_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=400, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.jwk_url'
+        db.add_column('openid_openidserver', 'jwk_url', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.jwk_encryption_url'
+        db.add_column('openid_openidserver', 'jwk_encryption_url', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.x509_url'
+        db.add_column('openid_openidserver', 'x509_url', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.x509_encryption_url'
+        db.add_column('openid_openidserver', 'x509_encryption_url', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.response_types_supported'
+        db.add_column('openid_openidserver', 'response_types_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.acrs_supported'
+        db.add_column('openid_openidserver', 'acrs_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.user_id_types_supported'
+        db.add_column('openid_openidserver', 'user_id_types_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.userinfo_algs_supported'
+        db.add_column('openid_openidserver', 'userinfo_algs_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.id_token_algs_supported'
+        db.add_column('openid_openidserver', 'id_token_algs_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.request_object_algs_supported'
+        db.add_column('openid_openidserver', 'request_object_algs_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.token_endpoint_auth_types_supported'
+        db.add_column('openid_openidserver', 'token_endpoint_auth_types_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.token_endpoint_auth_algs_supported'
+        db.add_column('openid_openidserver', 'token_endpoint_auth_algs_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Changing field 'OpenIDServer.registration_endpoint'
+        db.alter_column('openid_openidserver', 'registration_endpoint', self.gf('django.db.models.fields.CharField')(max_length=400, null=True))
+
+        # Changing field 'OpenIDServer.refresh_session_endpoint'
+        db.alter_column('openid_openidserver', 'refresh_session_endpoint', self.gf('django.db.models.fields.CharField')(max_length=400, null=True))
+
+        # Changing field 'OpenIDServer.token_endpoint'
+        db.alter_column('openid_openidserver', 'token_endpoint', self.gf('django.db.models.fields.CharField')(max_length=400, null=True))
+
+        # Changing field 'OpenIDServer.version'
+        db.alter_column('openid_openidserver', 'version', self.gf('django.db.models.fields.CharField')(max_length=200, null=True))
+
+        # Changing field 'OpenIDServer.end_session_endpoint'
+        db.alter_column('openid_openidserver', 'end_session_endpoint', self.gf('django.db.models.fields.CharField')(max_length=400, null=True))
+
+        # Changing field 'OpenIDServer.authorization_endpoint'
+        db.alter_column('openid_openidserver', 'authorization_endpoint', self.gf('django.db.models.fields.CharField')(max_length=400, null=True))
+
+        # Changing field 'OpenIDServer.issuer'
+        db.alter_column('openid_openidserver', 'issuer', self.gf('django.db.models.fields.CharField')(max_length=200, null=True))
+
+        # Removing index on 'OpenIDServer', fields ['issuer']
+        db.delete_index('openid_openidserver', ['issuer'])
+
+
+    def backwards(self, orm):
+        
+        # Adding index on 'OpenIDServer', fields ['issuer']
+        db.create_index('openid_openidserver', ['issuer'])
+
+        # Adding field 'OpenIDServer.introspection_endpoint'
+        db.add_column('openid_openidserver', 'introspection_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.check_session_endpoint'
+        db.add_column('openid_openidserver', 'check_session_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.identifiers_supported'
+        db.add_column('openid_openidserver', 'identifiers_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.user_info_endpoint'
+        db.add_column('openid_openidserver', 'user_info_endpoint', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.iso29115_supported'
+        db.add_column('openid_openidserver', 'iso29115_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.jwk_document'
+        db.add_column('openid_openidserver', 'jwk_document', self.gf('django.db.models.fields.TextField')(default='', null=True, blank=True), keep_default=False)
+
+        # Adding field 'OpenIDServer.flows_supported'
+        db.add_column('openid_openidserver', 'flows_supported', self.gf('django.db.models.fields.CharField')(default='', max_length=200, null=True, blank=True), keep_default=False)
+
+        # Deleting field 'OpenIDServer.check_id_endpoint'
+        db.delete_column('openid_openidserver', 'check_id_endpoint')
+
+        # Deleting field 'OpenIDServer.userinfo_endpoint'
+        db.delete_column('openid_openidserver', 'userinfo_endpoint')
+
+        # Deleting field 'OpenIDServer.jwk_url'
+        db.delete_column('openid_openidserver', 'jwk_url')
+
+        # Deleting field 'OpenIDServer.jwk_encryption_url'
+        db.delete_column('openid_openidserver', 'jwk_encryption_url')
+
+        # Deleting field 'OpenIDServer.x509_url'
+        db.delete_column('openid_openidserver', 'x509_url')
+
+        # Deleting field 'OpenIDServer.x509_encryption_url'
+        db.delete_column('openid_openidserver', 'x509_encryption_url')
+
+        # Deleting field 'OpenIDServer.response_types_supported'
+        db.delete_column('openid_openidserver', 'response_types_supported')
+
+        # Deleting field 'OpenIDServer.acrs_supported'
+        db.delete_column('openid_openidserver', 'acrs_supported')
+
+        # Deleting field 'OpenIDServer.user_id_types_supported'
+        db.delete_column('openid_openidserver', 'user_id_types_supported')
+
+        # Deleting field 'OpenIDServer.userinfo_algs_supported'
+        db.delete_column('openid_openidserver', 'userinfo_algs_supported')
+
+        # Deleting field 'OpenIDServer.id_token_algs_supported'
+        db.delete_column('openid_openidserver', 'id_token_algs_supported')
+
+        # Deleting field 'OpenIDServer.request_object_algs_supported'
+        db.delete_column('openid_openidserver', 'request_object_algs_supported')
+
+        # Deleting field 'OpenIDServer.token_endpoint_auth_types_supported'
+        db.delete_column('openid_openidserver', 'token_endpoint_auth_types_supported')
+
+        # Deleting field 'OpenIDServer.token_endpoint_auth_algs_supported'
+        db.delete_column('openid_openidserver', 'token_endpoint_auth_algs_supported')
+
+        # Changing field 'OpenIDServer.registration_endpoint'
+        db.alter_column('openid_openidserver', 'registration_endpoint', self.gf('django.db.models.fields.CharField')(max_length=200, null=True))
+
+        # Changing field 'OpenIDServer.refresh_session_endpoint'
+        db.alter_column('openid_openidserver', 'refresh_session_endpoint', self.gf('django.db.models.fields.CharField')(max_length=200, null=True))
+
+        # Changing field 'OpenIDServer.token_endpoint'
+        db.alter_column('openid_openidserver', 'token_endpoint', self.gf('django.db.models.fields.CharField')(max_length=200))
+
+        # Changing field 'OpenIDServer.version'
+        db.alter_column('openid_openidserver', 'version', self.gf('django.db.models.fields.CharField')(max_length=5))
+
+        # Changing field 'OpenIDServer.end_session_endpoint'
+        db.alter_column('openid_openidserver', 'end_session_endpoint', self.gf('django.db.models.fields.CharField')(max_length=200, null=True))
+
+        # Changing field 'OpenIDServer.authorization_endpoint'
+        db.alter_column('openid_openidserver', 'authorization_endpoint', self.gf('django.db.models.fields.CharField')(max_length=200))
+
+        # Changing field 'OpenIDServer.issuer'
+        db.alter_column('openid_openidserver', 'issuer', self.gf('django.db.models.fields.CharField')(max_length=200, unique=True))
+
+        # Adding unique constraint on 'OpenIDServer', fields ['issuer']
+        db.create_unique('openid_openidserver', ['issuer'])
+
+
+    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'})
+        },
+        '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'})
+        },
+        'openid.openid': {
+            'Meta': {'object_name': 'OpenID'},
+            'client_obj': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['openid.OpenIDClient']", 'null': 'True', 'blank': 'True'}),
+            'dt_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'dt_updated': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'openid': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'user': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
+        },
+        'openid.openidchecksessionrequest': {
+            'Meta': {'object_name': 'OpenIDCheckSessionRequest'},
+            'dt_request': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'is_valid': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'response': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'session_obj': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['openid.OpenIDSession']", 'null': 'True', 'blank': 'True'})
+        },
+        'openid.openidclient': {
+            'Meta': {'object_name': 'OpenIDClient'},
+            'client_id': ('django.db.models.fields.CharField', [], {'default': "'20120314023723180742229flQ'", 'max_length': '200'}),
+            'client_secret': ('django.db.models.fields.CharField', [], {'default': "'20120314023723181242rZgM2w'", 'max_length': '100'}),
+            'expires_in': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'host': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'response_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200'}),
+            'server_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDServer']"})
+        },
+        'openid.openidgrantrequest': {
+            'Meta': {'object_name': 'OpenIDGrantRequest'},
+            'client_id': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'client_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDClient']", 'null': 'True'}),
+            'display': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10'}),
+            'dt_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'nonce': ('django.db.models.fields.CharField', [], {'default': "''", 'unique': 'True', 'max_length': '100', 'db_index': 'True'}),
+            'prompt': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '10'}),
+            'redirect_uri': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'response_type': ('django.db.models.fields.CharField', [], {'default': "'token'", 'max_length': '50'}),
+            'scope': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '50'}),
+            'state': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '100'})
+        },
+        'openid.openidregrequest': {
+            'Meta': {'object_name': 'OpenIDRegRequest'},
+            'application_name': ('django.db.models.fields.CharField', [], {'default': "u'An OpenID Client'", 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'application_type': ('django.db.models.fields.CharField', [], {'default': "'web'", 'max_length': '20'}),
+            'client_id': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '50', 'null': 'True', 'blank': 'True'}),
+            'client_secret': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'contact': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'js_origin_uri': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'jwk_url': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'logo_url': ('django.db.models.fields.CharField', [], {'default': 'None', 'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'redirect_uri': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'sector_identifier': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+            'server_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDServer']"}),
+            'type': ('django.db.models.fields.CharField', [], {'default': "'client_associate'", 'max_length': '20'})
+        },
+        'openid.openidserver': {
+            'Meta': {'object_name': 'OpenIDServer'},
+            'acrs_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'authorization_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'check_id_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'end_session_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'id_token_algs_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'issuer': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'jwk_encryption_url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'jwk_url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'refresh_session_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'registration_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'request_object_algs_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'response_types_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'scopes_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'server_id': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200', 'db_index': 'True'}),
+            'supported_scopes': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200'}),
+            'token_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'token_endpoint_auth_algs_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'token_endpoint_auth_types_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'user_id_types_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'userinfo_algs_supported': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'userinfo_endpoint': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '400', 'null': 'True', 'blank': 'True'}),
+            'version': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'x509_encryption_url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'x509_url': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '200', 'null': 'True', 'blank': 'True'})
+        },
+        'openid.openidsession': {
+            'Meta': {'ordering': "['-dt_created']", 'object_name': 'OpenIDSession'},
+            'access_token': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'db_index': 'True'}),
+            'code': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'db_index': 'True'}),
+            'dt_created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'dt_expire': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2012, 3, 13, 18, 7, 23, 176247)'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'id_token': ('django.db.models.fields.TextField', [], {}),
+            'openid_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenID']"}),
+            'refresh_token': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255', 'db_index': 'True'}),
+            'request_obj': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['openid.OpenIDGrantRequest']", 'unique': 'True'}),
+            'scope': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
+            'server_obj': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['openid.OpenIDServer']"}),
+            'state': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '255'}),
+            'token_type': ('django.db.models.fields.CharField', [], {'default': "'Bearer'", 'max_length': '10'})
+        },
+        'openid.openiduserinfo': {
+            'Meta': {'object_name': 'OpenIDUserInfo'},
+            'address': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'birthday': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'email': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'family_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'gender': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'given_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'locale': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'middle_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'nickname': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'openid_obj': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['openid.OpenID']", 'unique': 'True'}),
+            'phone_number': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'picture': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'profile': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'updated_time': ('django.db.models.fields.DateTimeField', [], {}),
+            'user_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'verified': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'max_length': '255'}),
+            'website': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'zoneinfo': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'openid.openiduserinforequest': {
+            'Meta': {'object_name': 'OpenIDUserInfoRequest'},
+            'dt_request': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'dt_response': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+            'http_meta': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'request': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'response': ('django.db.models.fields.TextField', [], {'default': "''"}),
+            'session_obj': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['openid.OpenIDSession']", 'null': 'True', 'blank': 'True'})
+        }
+    }
+
+    complete_apps = ['openid']

src/accounts/openid/models.py

 import json
 
 from accounts.models import *
+from accounts.utils import entity_id
 from accounts.oauth.models import *
 
 class AbstractUserInfo(models.Model):
     class Meta:
         abstract =True
 
-class AbstractOpenIDOpConf(models.Model):
-    ''' OpenID OP  Configuraion 
+class AbstractOpenIDDiscoveryResponse(models.Model):
+    ''' OpenID OP  Discovery Response
 
         - Used by OP to publish this infomation to OpenID Discovery request described at :ref:`discovery_4`
         - Fields described in :ref:`discovery_table_1`
     '''
-    version   = models.CharField(u'Version',max_length=5,default='3.0')
-    ''' Version '''
-    issuer                   = models.CharField(u'Issuer',max_length=200,default='',db_index=True,unique=True,blank=True)  
-    ''' Issuer '''
-    check_session_endpoint   = models.CharField(u'Check Session Endpoint',max_length=200,default='',null=True,blank=True)
-    ''' Check Session Endpoint '''
-    end_session_endpoint     = models.CharField(u'End Session Endpoint',max_length=200,default='',null=True,blank=True)
-    ''' End Session Endpoint '''
-    introspection_endpoint   = models.CharField(u'Introspection Endpoint',max_length=200,default='',null=True,blank=True)
-    ''' Introspection Endpoint '''
-    refresh_session_endpoint = models.CharField(u'Refresh Session Endpoint',max_length=200,default='',null=True,blank=True)
-    ''' Refresh Session Endpoint '''
-    registration_endpoint    = models.CharField(u'Registration Endpoint',max_length=200,default='',null=True,blank=True)
-    ''' Registration Endpoint '''
-    user_info_endpoint       = models.CharField(u'UserInfo Endpoint',max_length=200,default='',null=True,blank=True)
-    ''' UserInfo Endpoint '''
+    version= models.CharField(max_length=200,default='3.0',null=True,blank=True)
+    issuer= models.CharField(max_length=200,default='',null=True,blank=True)
 
-    scopes_supported         = models.CharField(u'Scopes',max_length=200,default='',null=True,blank=True)
-    ''' :term:`OAuth 2.0` scopes supported in this OP  ( JSON array ) 
-    ''' 
-    flows_supported          = models.CharField(u'Flowes',max_length=200,default='',null=True,blank=True)
-    ''' :term:`OAuth 2.0` flows supported in this OP  ( JSON array ) 
-    ''' 
-    iso29115_supported       = models.CharField(u'ISO 291115 Assurance',max_length=200,default='',null=True,blank=True) 
-    ''' :term:`ISO 29115` assurance context suported in this OP (JSON array)''' 
+    # Endpoints
+    authorization_endpoint= models.CharField(max_length=400,default='',null=True,blank=True)
+    token_endpoint= models.CharField(max_length=400,default='',null=True,blank=True)
+    check_id_endpoint= models.CharField(max_length=400,default='',null=True,blank=True)
+    end_session_endpoint= models.CharField(max_length=400,default='',null=True,blank=True)
+    refresh_session_endpoint= models.CharField(max_length=400,default='',null=True,blank=True)
+    registration_endpoint= models.CharField(max_length=400,default='',null=True,blank=True)
+    userinfo_endpoint= models.CharField(max_length=400,default='',null=True,blank=True)
 
-    identifiers_supported    = models.CharField(u'User Identifier Types',max_length=200,default='',null=True,blank=True) 
-    ''' User Identifier Types supported in this OP(JSON array) '''
+    #JWT
+    jwk_url= models.CharField(max_length=200,default='',null=True,blank=True)
+    jwk_encryption_url= models.CharField(max_length=200,default='',null=True,blank=True)
+    x509_url= models.CharField(max_length=200,default='',null=True,blank=True)
+    x509_encryption_url= models.CharField(max_length=200,default='',null=True,blank=True)
 
-    jwk_document             = models.TextField(u'JSON Web Key Document',default='',null=True,blank=True )
-    ''' JSON Web Key (:term:`JWK` ) Document '''
+    # Support Option
+    scopes_supported= models.CharField(max_length=200,default='["openid"]',null=True,blank=True)
+    response_types_supported= models.CharField(max_length=200,null=True,blank=True,
+        default='["code","token","id_token","id_token token","code token","code id_token","code id_token token"]',)
+    acrs_supported= models.CharField(max_length=200,default='[]',null=True,blank=True)
+    user_id_types_supported= models.CharField(max_length=200,default='["pairwise","public"]',null=True,blank=True)
+
+    userinfo_algs_supported= models.CharField(max_length=200,default='',null=True,blank=True,
+        help_text="A JSON array containing a list of the JWS [JWS] and JWE [JWE] signing and encryption algorithms supported by the UserInfo Endpoint to encode the JWT [JWT]."
+    )      
+    id_token_algs_supported= models.CharField(max_length=200,default='',null=True,blank=True,
+        help_text="A JSON array containing a list of the JWS [JWS] and JWE [JWE] signing and encryption algorithms supported by the Authorization Server for the ID Token to encode the JWT [JWT]."
+    )
+    request_object_algs_supported= models.CharField(max_length=200,default='',null=True,blank=True,
+        help_text="A JSON array containing a list of the JWS [JWS] and JWE [JWE] signing and encryption algorithms supported by the Authorization Server for the OpenID Request Object described in Section 2.1.2.1 of OpenID Connect Messages 1.0 [OpenID.Messages] to encode the JWT [JWT]. Servers SHOULD support HS256."
+    )
+    token_endpoint_auth_types_supported= models.CharField(max_length=200,null=True,blank=True,
+        default='["client_secret_basic"]',
+        help_text="A JSON array containing a list of authentication types supported by this Token Endpoint. The options are client_secret_post, client_secret_basic, client_secret_jwt, and private_key_jwt, as described in Section 2.2.1 of OpenID Connect Messages 1.0 [OpenID.Messages]. Other Authentication types may be defined by extension. If unspecified or omitted, the default is client_secret_basic HTTP Basic Authentication Scheme as specified in section 2.3.1 of OAuth 2.0 [OAuth2.0]."
+    )
+    token_endpoint_auth_algs_supported= models.CharField(max_length=200,default='["RS256"]',null=True,blank=True,
+        help_text="A JSON array containing a list of the JWS [JWS] signing algorithms supported by the Token Endpoint for the private_key_jwt method to encode the JWT [JWT]. Servers SHOULD support RS256."
+    )
 
     class Meta:
         abstract = True
 
+class OpenIDDiscoveryResponseImpl:
+    def discovery_response(self,**kwargs):
+        ''' 
+            - self : AbstractOpenIDDiscoveryResponse instance 
+        '''
+        dv = dict(
+            [(f.name,getattr(self,f.name))
+                 for f in AbstractOpenIDDiscoveryResponse._meta.fields ]
+            )
+        for k,v in dv.items():
+            if re.search(r'^\[.*\]',v):
+                dv[k] = eval(v)
+        return json.dumps( dv, **kwargs)
+    
 class AbstractRequestLog(models.Model):
     ''' Abstract
     '''
 
         return rp
     
-class OpenIDServer(AbstractOAuthServer,AbstractOpenIDOpConf,OpenIDServerImpl ):
+class OpenIDServer(AbstractOpenIDDiscoveryResponse,
+                   OpenIDDiscoveryResponseImpl,
+                   OpenIDServerImpl ):
     ''' OpenID/OAuth server data model
     
-        - :ref:`accounts.oauth.models.AbstractOAuthServer`
-        - :ref:`accounts.openid.models.AbstractOpenIDOpConf`
+        - :ref:`accounts.openid.models.AbstractOpenIDDiscoveryResponse`
         - :ref:`accounts.openid.models.OpenIDServerImpl`
     '''
 
+    server_id = models.CharField(u'server_id',max_length=200, db_index=True, unique=True) 
+    ''' Server Identifier (server_id MUST be unique)''' 
+
     def __unicode__(self):
         return self.server_id
 

src/accounts/openid/tests.py

 # -*- coding: utf-8 -*-
+
+import sys 
+if sys.version_info < (2,7):
+    import unittest2 as unittest
+
 """
 This file demonstrates two different styles of tests (one doctest and one
 unittest). These will both pass when you run "manage.py test".
 """
 
 from django.test import TestCase
+from django.contrib.auth.models import User
+from django.core.urlresolvers import reverse
+
 from models import *
-from django.contrib.auth.models import User
-import jwt
+#import jwt
 
 import urllib,cgi,os
 
+from accounts.tests import BasicTest
+class OpenIDServerTest(BasicTest):
+    '''
+    '''
+
+    def test_discovery_response(self ):
+        '''
+        python manage.py test openid.OpenIDServerTest.test_discovery_response
+        '''
+        self.load_json_fixture("openid/fixtures/dev","fixture.openid_openidserver.1.json")
+
+        from accounts.openid.models import OpenIDServer
+        self.assertEqual(OpenIDServer.objects.count(),1)
+
+        import json
+    
+        from accounts.openid.views import  OPENID_CONFIGURATION_DISPATHCER
+        
+        from urlparse import urlparse
+        u = urlparse( OpenIDServer.objects.all()[0].server_id )
+
+        req = self.request_factory.get(reverse(  OPENID_CONFIGURATION_DISPATHCER.name ))
+        req.META['HTTP_HOST']= u.netloc
+
+        response = OPENID_CONFIGURATION_DISPATHCER.callback(req)
+
 class OpenIDRpTest(TestCase):
     '''  Sepcify running server_id ( http://op.net:8001/ )
         

src/accounts/openid/views.py

 import settings
 import urllib2
 import json
+import traceback,sys
 
-@csrf_exempt
-def openid_conf(request):
-    ''' OP reutrns  OpenID OP Configuration based on :ref:`discovery_4`.
-
-    '''
-
-    conf= OpenIDServer.objects.opconf(request)
-    for k in conf:
-        if re.search(r"^[{\[].*[}\]]$",conf[k]):    #: JSON objects are expected.
-            conf[k] = eval(conf[k] )
-
-    response = HttpResponse() 
-    response['Content-Type'] = "application/json"
-    response.write( json.dumps( conf ) ) 
-    return response
 
 def rp_begin(request):
     ''' RP - Staring a new OpenID Authentication Session
             {'form': AuthenticationForm(),'action':reverse('accounts_login')  },
                 context_instance=template.RequestContext(request),)
 
+def op_check_id(request):
+    ''' OP - Check ID Token
+
+    .. todo::
+         implemnet Check ID Endpoint 
+    '''
+    return HttpResponse( "Check ID Endpoint ")
+
+@csrf_exempt
+def op_discovery(request):
+    server_id = entity_id(request) 
+    response = HttpResponse() 
+    response['Content-Type'] = "application/json"
+    try:
+        response.write( OpenIDServer.objects.get(server_id=server_id).discovery_response(indent=2) ) 
+    except OpenIDServer.DoesNotExist,e:
+        traceback.print_exc(file=sys.stdout)
+    except Exception,e:
+        traceback.print_exc(file=sys.stdout)
+        pass
+    return response
+
+# Name map for endpoints name of Discovery
+_urlname_map={
+    'authorization_endpoint' :      'accounts_openid_op_request',
+    'check_id_endpoint' :           'accounts_openid_op_check_id',
+    'end_session_endpoint' :        'accounts_openid_op_end_session',
+    'refresh_session_endpoint' :    'accounts_openid_op_refresh_session',
+    'registration_endpoint' :       'accounts_openid_op_registration',
+    'token_endpoint' :              'accounts_openid_op_token', 
+    'userinfo_endpoint' :           'accounts_openid_op_userinfo',
+}
+
+def endpoint(discovery_name,host=''):
+    ''' Resolve URL 
+    '''
+    return  host + reverse( _urlname_map[discovery_name] )
+
 
 from django.conf.urls.defaults import *
 
+OPENID_CONFIGURATION_DISPATHCER=  url(r'^.well-known/openid-configuration',op_discovery,
+                name='accounts_openid_op_discovery')
+ 
 urlpatterns = patterns('acounts.openid.views',
     url(r'^rp/begin',rp_begin,name='accounts_openid_rp_begin'),
 
     url(r'^op/refresh_session',op_refresh_session,name='accounts_openid_op_refresh_session'),
     url(r'^op/token',op_token,name='accounts_openid_op_token'),
     url(r'^op/registration',op_registration,name='accounts_openid_op_registration'),
+    url(r'^op/check_id',op_check_id,name='accounts_openid_op_check_id'),
 )

src/accounts/tests.py

 # -*- coding: utf-8 -*-
-"""
-This file demonstrates two different styles of tests (one doctest and one
-unittest). These will both pass when you run "manage.py test".
 
-Replace these with more appropriate tests for your application.
-"""
+import sys 
+if sys.version_info < (2,7):
+    import unittest2 as unittest
 
 from django.test import TestCase
-from accounts.models import *
-from django.contrib.auth.models import User
-import jwt
+from django.test.client import RequestFactory
+from django.core import serializers
 
 import urllib,cgi,os
 
-#class OpenIDTest(TestCase):
-#    fixtures = ['initial_data','openid','openidrequest','user',]
-#
-#    def test_create_request(self):
-#        """ 
-#        python manage.py test accounts.OpenIDTest.test_create_request
-#        """
-#        req = OpenIDClient.objects.get(client_id='rp.com').create_request()
-#        print req.urlparams()
-#        self.failUnless(req.id , OpenIDRequest.objects.all()[0].id )        
-# 
-#    def test_accept_request(self):
-#        """ 
-#        python manage.py test accounts.OpenIDTest.test_accept_request
-#        """
-#        req = OpenIDClient.objects.get(client_id='rp.com').create_request()
-#        params = dict([ (k,v[0]) for k,v in  cgi.parse_qs( req.urlparams() ).items() ] )
-#        print params
-#
-#    def test_get_openid(self):
-#        """ 
-#        python manage.py test accounts.OpenIDTest.test_get_openid
-#
-#        """
-#
-#        req = OpenIDRequest.objects.all() 
-#        user = User.objects.get(username='user1')       #: user.json  
-#        openid1 = OpenIDServer.objects.get(server_id='op.net').get_openid(user,req[0] )
-#        openid2 = OpenIDServer.objects.get(server_id='op.net').get_openid(user,req[0] )
-#
-#        self.failUnless(openid1,openid2 )
-#
-#    def test_create_openid_session(self):
-#        """ 
-#        python manage.py test accounts.OpenIDTest.test_create_openid_session
-#
-#        """
-#
-#        req = OpenIDRequest.objects.all() 
-#        user = User.objects.get(username='user1')       #: user.json  
-#        openid = OpenIDServer.objects.get(server_id='op.net').get_openid(user,req[0] )
-#        session = openid.create_session(req[0] ) 
-#        self.failIfEqual(session,None )
-#        self.failIfEqual(OpenIDSession.objects.count(),0 )
-#        print session.id_token
-#        print "Token Length = ", len(session.id_token )
-#        print session.response_url()
-#        print "URL Length = ", len(session.response_url() )
-#        print jwt.decode(session.id_token,key=openid.client.client_secret ) 
-#    
-#
-##__test__ = {"doctest": """
-##Another way to test that 1 + 1 is equal to 2.
-##
-##>>> 1 + 1 == 2
-##True
-##"""}
-##
+class BasicTest(TestCase):
+
+    fixtures = []
+
+    def setUp(self):
+        self.request_factory = RequestFactory()
+
+    def fixture_path(self,path,filename):
+        return os.path.join(                
+            os.path.join( os.path.dirname(os.path.abspath(__file__)), path ),
+                    filename)    
+
+    def open_fixture(self,path,filename):
+        return open( self.fixture_path(path,filename)  
+        )   
+
+    def load_json_fixture(self,path,filename):
+        map(lambda m:m.save(), 
+            serializers.deserialize('json',self.open_fixture(path,filename)) )        

src/accounts/urls.py

     url(r"^login/$", LoginView.as_view(), name="accounts_login"),
     url(r"^logout/$", LogoutView.as_view(), name="accounts_logout"),
     url(r'^profile/', ProfileView.as_view() ,name='accounts_profile' ),
+
+    url(r'^openid/', include("accounts.openid.views")),
 )

src/accounts/utils.py

     return  when.strftime('%Y%m%d%H%M%S%f'+salt)
 
 def entity_id(request):
-    ''' Entity Identifier '''
     return  "%s://%s" % (request.META['wsgi.url_scheme'],request.META['HTTP_HOST']   )