From 1a74bcbc5cdc10a40bd6b252ef59836b6c39c959 Mon Sep 17 00:00:00 2001 From: Ignacio Fiorentino Date: Mon, 4 Apr 2016 17:19:49 -0300 Subject: [PATCH] Add client type to client creation form. --- .../migrations/0011_client_client_type.py | 20 +++++++++++++++++++ oidc_provider/models.py | 9 +++++++-- 2 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 oidc_provider/migrations/0011_client_client_type.py diff --git a/oidc_provider/migrations/0011_client_client_type.py b/oidc_provider/migrations/0011_client_client_type.py new file mode 100644 index 0000000..26e9fc3 --- /dev/null +++ b/oidc_provider/migrations/0011_client_client_type.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9 on 2016-04-04 19:56 +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('oidc_provider', '0010_code_is_authentication'), + ] + + operations = [ + migrations.AddField( + model_name='client', + name='client_type', + field=models.CharField(choices=[(b'confidential', b'Confidential'), (b'public', b'Public')], default=b'confidential', help_text='Confidential clients are capable of maintaining the confidentiality of their credentials. Public clients are incapable.', max_length=30), + ), + ] diff --git a/oidc_provider/models.py b/oidc_provider/models.py index 68ace73..69dcc39 100644 --- a/oidc_provider/models.py +++ b/oidc_provider/models.py @@ -10,6 +10,11 @@ from django.conf import settings class Client(models.Model): + CLIENT_TYPE_CHOICES = [ + ('confidential', 'Confidential'), + ('public', 'Public'), + ] + RESPONSE_TYPE_CHOICES = [ ('code', 'code (Authorization Code Flow)'), ('id_token', 'id_token (Implicit Flow)'), @@ -17,10 +22,10 @@ class Client(models.Model): ] name = models.CharField(max_length=100, default='') + client_type = models.CharField(max_length=30, choices=CLIENT_TYPE_CHOICES, default='confidential', help_text=_(u'Confidential clients are capable of maintaining the confidentiality of their credentials. Public clients are incapable.')) client_id = models.CharField(max_length=255, unique=True) client_secret = models.CharField(max_length=255, unique=True) - response_type = models.CharField(max_length=30, - choices=RESPONSE_TYPE_CHOICES) + response_type = models.CharField(max_length=30, choices=RESPONSE_TYPE_CHOICES) date_created = models.DateField(auto_now_add=True) _redirect_uris = models.TextField(default='', verbose_name=_(u'Redirect URI'), help_text=_(u'Enter each URI on a new line.'))