diff --git a/oidc_provider/admin.py b/oidc_provider/admin.py index 71ee638..1a05dbd 100644 --- a/oidc_provider/admin.py +++ b/oidc_provider/admin.py @@ -4,6 +4,7 @@ from uuid import uuid4 from django.forms import ModelForm from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ from oidc_provider.models import Client, Code, Token, RSAKey @@ -48,6 +49,17 @@ class ClientForm(ModelForm): @admin.register(Client) class ClientAdmin(admin.ModelAdmin): + fieldsets = [ + [_(u''), { + 'fields': ('name', 'client_type', 'response_type','_redirect_uris', 'jwt_alg'), + }], + [_(u'Credentials'), { + 'fields': ('client_id', 'client_secret'), + }], + [_(u'Information'), { + 'fields': ('contact_email', 'website_url', 'terms_url', 'logo', 'date_created'), + }], + ] form = ClientForm list_display = ['name', 'client_id', 'response_type', 'date_created'] readonly_fields = ['date_created'] diff --git a/oidc_provider/migrations/0020_auto_20160909_1836.py b/oidc_provider/migrations/0020_auto_20160909_1836.py new file mode 100644 index 0000000..d2eb663 --- /dev/null +++ b/oidc_provider/migrations/0020_auto_20160909_1836.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-09-09 18:36 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('oidc_provider', '0019_auto_20160908_1519'), + ] + + operations = [ + migrations.AddField( + model_name='client', + name='contact_email', + field=models.CharField(blank=True, default=b'', max_length=255, verbose_name='Contact Email'), + ), + migrations.AddField( + model_name='client', + name='logo', + field=models.FileField(blank=True, default=b'', upload_to=b'oidc_provider/clients', verbose_name='Logo Image'), + ), + migrations.AddField( + model_name='client', + name='terms_url', + field=models.CharField(blank=True, default=b'', help_text='External reference to the privacy policy of the client.', max_length=255, verbose_name='Terms URL'), + ), + migrations.AddField( + model_name='client', + name='website_url', + field=models.CharField(blank=True, default=b'', max_length=255, verbose_name='Website URL'), + ), + ] diff --git a/oidc_provider/migrations/0021_auto_20160909_1855.py b/oidc_provider/migrations/0021_auto_20160909_1855.py new file mode 100644 index 0000000..2115edd --- /dev/null +++ b/oidc_provider/migrations/0021_auto_20160909_1855.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-09-09 18:55 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('oidc_provider', '0020_auto_20160909_1836'), + ] + + operations = [ + migrations.AlterField( + model_name='client', + name='jwt_alg', + field=models.CharField(choices=[(b'HS256', b'HS256'), (b'RS256', b'RS256')], default=b'RS256', help_text='Algorithm used to encode ID Tokens.', max_length=10, verbose_name='JWT Algorithm'), + ), + ] diff --git a/oidc_provider/models.py b/oidc_provider/models.py index 3456e50..4167b96 100644 --- a/oidc_provider/models.py +++ b/oidc_provider/models.py @@ -37,8 +37,12 @@ class Client(models.Model): client_id = models.CharField(max_length=255, unique=True, verbose_name=_(u'Client ID')) client_secret = models.CharField(max_length=255, blank=True, default='', verbose_name=_(u'Client SECRET')) response_type = models.CharField(max_length=30, choices=RESPONSE_TYPE_CHOICES, verbose_name=_(u'Response Type')) - jwt_alg = models.CharField(max_length=10, choices=JWT_ALGS, default='RS256', verbose_name=_(u'JWT Algorithm')) + jwt_alg = models.CharField(max_length=10, choices=JWT_ALGS, default='RS256', verbose_name=_(u'JWT Algorithm'), help_text=_(u'Algorithm used to encode ID Tokens.')) date_created = models.DateField(auto_now_add=True, verbose_name=_(u'Date Created')) + website_url = models.CharField(max_length=255, blank=True, default='', verbose_name=_(u'Website URL')) + terms_url = models.CharField(max_length=255, blank=True, default='', verbose_name=_(u'Terms URL'), help_text=_(u'External reference to the privacy policy of the client.')) + contact_email = models.CharField(max_length=255, blank=True, default='', verbose_name=_(u'Contact Email')) + logo = models.FileField(blank=True, default='', upload_to='oidc_provider/clients', verbose_name=_(u'Logo Image')) _redirect_uris = models.TextField(default='', verbose_name=_(u'Redirect URIs'), help_text=_(u'Enter each URI on a new line.'))