@@ -179,13 +179,13 @@ def put_together_aud(recv, aud=None):
179
179
180
180
return _aud
181
181
182
- def pack_init (self , recv , aud ):
182
+ def pack_init (self , recv , aud , iat = None ):
183
183
"""
184
184
Gather initial information for the payload.
185
185
186
186
:return: A dictionary with claims and values
187
187
"""
188
- argv = {"iss" : self .iss , "iat" : utc_time_sans_frac ()}
188
+ argv = {"iss" : self .iss , "iat" : iat or utc_time_sans_frac ()}
189
189
if self .lifetime :
190
190
argv ["exp" ] = argv ["iat" ] + self .lifetime
191
191
@@ -210,7 +210,7 @@ def pack_key(self, issuer_id="", kid=""):
210
210
211
211
return keys [0 ] # Might be more then one if kid == ''
212
212
213
- def pack (self , payload = None , kid = "" , issuer_id = "" , recv = "" , aud = None , ** kwargs ):
213
+ def pack (self , payload = None , kid = "" , issuer_id = "" , recv = "" , aud = None , iat = None , ** kwargs ):
214
214
"""
215
215
216
216
:param payload: Information to be carried as payload in the JWT
@@ -219,13 +219,14 @@ def pack(self, payload=None, kid="", issuer_id="", recv="", aud=None, **kwargs):
219
219
:param recv: The intended immediate receiver
220
220
:param aud: Intended audience for this JWS/JWE, not expected to
221
221
contain the recipient.
222
+ :param iat: Override issued at (default current timestamp)
222
223
:param kwargs: Extra keyword arguments
223
224
:return: A signed or signed and encrypted Json Web Token
224
225
"""
225
226
_args = {}
226
227
if payload is not None :
227
228
_args .update (payload )
228
- _args .update (self .pack_init (recv , aud ))
229
+ _args .update (self .pack_init (recv , aud , iat ))
229
230
230
231
try :
231
232
_encrypt = kwargs ["encrypt" ]
0 commit comments