support multiple response types per client
The Dynamic Client Registration spec specifies multiple response_types and grant_types per client (https://openid.net/specs/openid-connect-registration-1_0.html#ClientMetadata). Since grant_types can be inferred from response_types we should be able to support both without needing to store grant_types. This also helps with oidc-client-js which expects a client that supports both "id_token" and "id_token token".
This commit is contained in:
parent
b5e055205c
commit
36018d19ae
8 changed files with 132 additions and 26 deletions
|
@ -30,6 +30,20 @@ JWT_ALGS = [
|
|||
]
|
||||
|
||||
|
||||
class ResponseType(models.Model):
|
||||
value = models.CharField(
|
||||
max_length=30,
|
||||
choices=RESPONSE_TYPE_CHOICES,
|
||||
unique=True,
|
||||
verbose_name=_(u'Response Type Value'))
|
||||
description = models.CharField(
|
||||
max_length=50,
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
return u'{0}'.format(self.description)
|
||||
|
||||
|
||||
class Client(models.Model):
|
||||
|
||||
name = models.CharField(max_length=100, default='', verbose_name=_(u'Name'))
|
||||
|
@ -45,8 +59,7 @@ class Client(models.Model):
|
|||
u' of their credentials. <b>Public</b> clients are incapable.'))
|
||||
client_id = models.CharField(max_length=255, unique=True, verbose_name=_(u'Client ID'))
|
||||
client_secret = models.CharField(max_length=255, blank=True, verbose_name=_(u'Client SECRET'))
|
||||
response_type = models.CharField(
|
||||
max_length=30, choices=RESPONSE_TYPE_CHOICES, verbose_name=_(u'Response Type'))
|
||||
response_types = models.ManyToManyField(ResponseType)
|
||||
jwt_alg = models.CharField(
|
||||
max_length=10,
|
||||
choices=JWT_ALGS,
|
||||
|
@ -99,6 +112,12 @@ class Client(models.Model):
|
|||
def __unicode__(self):
|
||||
return self.__str__()
|
||||
|
||||
def response_type_values(self):
|
||||
return (response_type.value for response_type in self.response_types.all())
|
||||
|
||||
def response_type_descriptions(self):
|
||||
return [response_type.description for response_type in self.response_types.all()]
|
||||
|
||||
@property
|
||||
def redirect_uris(self):
|
||||
return self._redirect_uris.splitlines()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue