Projet

Général

Profil

0001-let-a2-use-django.contrib.postgres-native-jsonfield-.patch

Paul Marillonnet, 17 décembre 2018 19:07

Télécharger (2,77 ko)

Voir les différences:

Subject: [PATCH] let a2 use django.contrib.postgres' native jsonfield (#29144)

 src/authentic2_auth_oidc/migrations/0001_initial.py | 7 +++++--
 src/authentic2_auth_oidc/models.py                  | 5 ++++-
 2 files changed, 9 insertions(+), 3 deletions(-)
src/authentic2_auth_oidc/migrations/0001_initial.py
2 2
from __future__ import unicode_literals
3 3

  
4 4
from django.db import migrations, models
5
import jsonfield.fields
5
try:
6
    from django.contrib.postgres.fields.jsonb import JSONField
7
except:
8
    from jsonfield.fields import JSONField
6 9
import authentic2.a2_rbac.utils
7 10
import authentic2_auth_oidc.models
8 11
from django.conf import settings
......
52 55
                ('userinfo_endpoint', models.URLField(max_length=128, verbose_name='userinfo endpoint')),
53 56
                ('end_session_endpoint', models.URLField(max_length=128, null=True, verbose_name='end session endpoint', blank=True)),
54 57
                ('scopes', models.CharField(max_length=128, verbose_name='scopes', blank=True)),
55
                ('jwkset_json', jsonfield.fields.JSONField(blank=True, null=True, verbose_name='JSON WebKey set', validators=[authentic2_auth_oidc.models.validate_jwkset])),
58
                ('jwkset_json', JSONField(blank=True, null=True, verbose_name='JSON WebKey set', validators=[authentic2_auth_oidc.models.validate_jwkset])),
56 59
                ('idtoken_algo', models.PositiveIntegerField(default=1, verbose_name='IDToken signature algorithm', choices=[(0, 'none'), (1, 'RSA'), (2, 'HMAC')])),
57 60
                ('strategy', models.CharField(max_length=32, verbose_name='strategy', choices=[(b'create', 'create'), (b'none', 'none')])),
58 61
                ('max_auth_age', models.PositiveIntegerField(null=True, verbose_name='max authentication age', blank=True)),
src/authentic2_auth_oidc/models.py
6 6
from django.conf import settings
7 7
from django.core.exceptions import ValidationError
8 8

  
9
from jsonfield import JSONField
9
try:
10
    from django.contrib.postgres.fields import JSONField # dj1.11 native JSON
11
except:
12
    from jsonfield import JSONField # django-jsonfield outer module
10 13

  
11 14
from jwcrypto.jwk import JWKSet, InvalidJWKValue, JWK
12 15

  
13
-