Add more attr to Client object.
This commit is contained in:
parent
c14d2f055a
commit
1973ce1108
4 changed files with 72 additions and 1 deletions
|
@ -4,6 +4,7 @@ from uuid import uuid4
|
||||||
|
|
||||||
from django.forms import ModelForm
|
from django.forms import ModelForm
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from oidc_provider.models import Client, Code, Token, RSAKey
|
from oidc_provider.models import Client, Code, Token, RSAKey
|
||||||
|
|
||||||
|
@ -48,6 +49,17 @@ class ClientForm(ModelForm):
|
||||||
@admin.register(Client)
|
@admin.register(Client)
|
||||||
class ClientAdmin(admin.ModelAdmin):
|
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
|
form = ClientForm
|
||||||
list_display = ['name', 'client_id', 'response_type', 'date_created']
|
list_display = ['name', 'client_id', 'response_type', 'date_created']
|
||||||
readonly_fields = ['date_created']
|
readonly_fields = ['date_created']
|
||||||
|
|
35
oidc_provider/migrations/0020_auto_20160909_1836.py
Normal file
35
oidc_provider/migrations/0020_auto_20160909_1836.py
Normal file
|
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
20
oidc_provider/migrations/0021_auto_20160909_1855.py
Normal file
20
oidc_provider/migrations/0021_auto_20160909_1855.py
Normal file
|
@ -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'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -37,8 +37,12 @@ class Client(models.Model):
|
||||||
client_id = models.CharField(max_length=255, unique=True, verbose_name=_(u'Client ID'))
|
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'))
|
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'))
|
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'))
|
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.'))
|
_redirect_uris = models.TextField(default='', verbose_name=_(u'Redirect URIs'), help_text=_(u'Enter each URI on a new line.'))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue