Merge branch 'master' of https://github.com/juanifioren/django-oidc-provider into v0.1.0-dev
Conflicts: example_project/.gitignore
This commit is contained in:
commit
a08dbdb7d2
11 changed files with 82 additions and 44 deletions
|
@ -10,7 +10,7 @@ from oidc_provider.models import *
|
|||
from oidc_provider import settings
|
||||
|
||||
|
||||
def create_id_token(user, aud, nonce=None):
|
||||
def create_id_token(user, aud, nonce):
|
||||
"""
|
||||
Receives a user object and aud (audience).
|
||||
Then creates the id_token dictionary.
|
||||
|
@ -22,13 +22,12 @@ def create_id_token(user, aud, nonce=None):
|
|||
|
||||
expires_in = settings.get('OIDC_IDTOKEN_EXPIRE')
|
||||
|
||||
now = timezone.now()
|
||||
# Convert datetimes into timestamps.
|
||||
iat_time = time.mktime(now.timetuple())
|
||||
exp_time = time.mktime((now + timedelta(seconds=expires_in)).timetuple())
|
||||
|
||||
now = timezone.now()
|
||||
iat_time = int(time.mktime(now.timetuple()))
|
||||
exp_time = int(time.mktime((now + timedelta(seconds=expires_in)).timetuple()))
|
||||
user_auth_time = user.last_login or user.date_joined
|
||||
auth_time = time.mktime(user_auth_time.timetuple())
|
||||
auth_time = int(time.mktime(user_auth_time.timetuple()))
|
||||
|
||||
dic = {
|
||||
'iss': get_issuer(),
|
||||
|
@ -75,7 +74,7 @@ def create_token(user, client, id_token_dic, scope):
|
|||
return token
|
||||
|
||||
|
||||
def create_code(user, client, scope):
|
||||
def create_code(user, client, scope, nonce):
|
||||
"""
|
||||
Create and populate a Code object.
|
||||
|
||||
|
@ -88,5 +87,6 @@ def create_code(user, client, scope):
|
|||
code.expires_at = timezone.now() + timedelta(
|
||||
seconds=settings.get('OIDC_CODE_EXPIRE'))
|
||||
code.scope = scope
|
||||
code.nonce = nonce
|
||||
|
||||
return code
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue