flake8 fixes
This commit is contained in:
parent
ffddb69f80
commit
e04d42fedf
4 changed files with 17 additions and 9 deletions
|
@ -26,6 +26,7 @@ JWT_ALGS = [
|
|||
('RS256', 'RS256'),
|
||||
]
|
||||
|
||||
|
||||
class Client(models.Model):
|
||||
|
||||
name = models.CharField(max_length=100, default='', verbose_name=_(u'Name'))
|
||||
|
@ -51,8 +52,10 @@ class Client(models.Model):
|
|||
def redirect_uris():
|
||||
def fget(self):
|
||||
return self._redirect_uris.splitlines()
|
||||
|
||||
def fset(self, value):
|
||||
self._redirect_uris = '\n'.join(value)
|
||||
|
||||
return locals()
|
||||
redirect_uris = property(**redirect_uris())
|
||||
|
||||
|
@ -71,8 +74,10 @@ class BaseCodeTokenModel(models.Model):
|
|||
def scope():
|
||||
def fget(self):
|
||||
return self._scope.split()
|
||||
|
||||
def fset(self, value):
|
||||
self._scope = ' '.join(value)
|
||||
|
||||
return locals()
|
||||
scope = property(**scope())
|
||||
|
||||
|
@ -107,11 +112,15 @@ class Token(BaseCodeTokenModel):
|
|||
access_token = models.CharField(max_length=255, unique=True, verbose_name=_(u'Access Token'))
|
||||
refresh_token = models.CharField(max_length=255, unique=True, null=True, verbose_name=_(u'Refresh Token'))
|
||||
_id_token = models.TextField(verbose_name=_(u'ID Token'))
|
||||
|
||||
def id_token():
|
||||
|
||||
def fget(self):
|
||||
return json.loads(self._id_token)
|
||||
|
||||
def fset(self, value):
|
||||
self._id_token = json.dumps(value)
|
||||
|
||||
return locals()
|
||||
id_token = property(**id_token())
|
||||
|
||||
|
@ -156,4 +165,4 @@ class RSAKey(models.Model):
|
|||
|
||||
@property
|
||||
def kid(self):
|
||||
return u'{0}'.format(md5(self.key.encode('utf-8')).hexdigest() if self.key else '')
|
||||
return u'{0}'.format(md5(self.key.encode('utf-8')).hexdigest() if self.key else '')
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
try:
|
||||
from urllib.parse import unquote, urlencode
|
||||
from urllib.parse import urlencode
|
||||
except ImportError:
|
||||
from urllib import unquote, urlencode
|
||||
from urllib import urlencode
|
||||
import uuid
|
||||
|
||||
from django.contrib.auth import REDIRECT_FIELD_NAME
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
from django.core.management import call_command
|
||||
from django.core.urlresolvers import reverse
|
||||
|
|
|
@ -3,9 +3,9 @@ try:
|
|||
except ImportError:
|
||||
from urllib import urlencode
|
||||
try:
|
||||
from urllib.parse import urlparse, parse_qs
|
||||
from urllib.parse import parse_qs, urlsplit
|
||||
except ImportError:
|
||||
from urlparse import urlparse, parse_qs
|
||||
from urlparse import parse_qs, urlsplit
|
||||
import uuid
|
||||
|
||||
from django.contrib.auth.models import AnonymousUser
|
||||
|
|
|
@ -193,8 +193,8 @@ class ProviderInfoView(View):
|
|||
# See: http://openid.net/specs/openid-connect-core-1_0.html#SubjectIDTypes
|
||||
dic['subject_types_supported'] = ['public']
|
||||
|
||||
dic['token_endpoint_auth_methods_supported'] = [ 'client_secret_post',
|
||||
'client_secret_basic' ]
|
||||
dic['token_endpoint_auth_methods_supported'] = ['client_secret_post',
|
||||
'client_secret_basic']
|
||||
|
||||
return JsonResponse(dic)
|
||||
|
||||
|
@ -205,7 +205,7 @@ class JwksView(View):
|
|||
dic = dict(keys=[])
|
||||
|
||||
for rsakey in RSAKey.objects.all():
|
||||
public_key = RSA.importKey(rsakey.key).publickey()
|
||||
public_key = RSA.importKey(rsakey.key).publickey()
|
||||
dic['keys'].append({
|
||||
'kty': 'RSA',
|
||||
'alg': 'RS256',
|
||||
|
|
Loading…
Reference in a new issue