Beispiel #1
0
 def topic(self):
     """ generate tokens, one with lifetime, one with expires """
     lt = timedelta(seconds=exp)
     now = datetime.utcnow()
     not_before = (now + timedelta(minutes=nbf)) if nbf else None
     if callable(privk):
         token = privk(payload, alg, lt, not_before=not_before)
     else:
         token = jwt.generate_jwt(payload,
                                  privk,
                                  alg,
                                  lt,
                                  not_before=not_before,
                                  jti_size=jti_size)
     yield clock_tick(timedelta(milliseconds=1500)), token
     now = datetime.utcnow()
     not_before = (now + timedelta(minutes=nbf)) if nbf else None
     if callable(privk):
         token = privk(payload,
                       alg,
                       expires=(now + lt),
                       not_before=not_before)
     else:
         token = jwt.generate_jwt(payload,
                                  privk,
                                  alg,
                                  expires=(now + lt),
                                  not_before=not_before,
                                  jti_size=jti_size)
     yield clock_tick(timedelta(milliseconds=1500)), token
 def topic(self, topic):
     """ Verify the token without requiring all claims """
     adjust = orig_datetime.utcnow() - orig_datetime.utcfromtimestamp(0)
     clock_tick(-adjust)
     return jwt.verify_jwt(topic,
                           None,
                           iat_skew=adjust,
                           checks_optional=True)
 def topic(self, topic):
     """ Verify the token without requiring all claims """
     adjust = orig_datetime.utcnow() - orig_datetime.utcfromtimestamp(0)
     clock_tick(-adjust)
     return jwt.verify_jwt(topic,
                           None,
                           iat_skew=adjust,
                           checks_optional=True)
Beispiel #4
0
 def topic(self):
     """ generate tokens, one with lifetime, one with expires """
     lt = timedelta(seconds=exp)
     now = datetime.utcnow()
     not_before = (now + timedelta(minutes=nbf)) if nbf else None
     if callable(privk):
         token = privk(payload, alg, lt, not_before=not_before)
     else:
         token = jwt.generate_jwt(payload, privk, alg, lt,
                                  not_before=not_before)
     yield clock_tick(timedelta(milliseconds=1500)), token
     now = datetime.utcnow()
     not_before = (now + timedelta(minutes=nbf)) if nbf else None
     if callable(privk):
         token = privk(payload, alg,
                       expires=(now + lt),
                       not_before=not_before)
     else:
         token = jwt.generate_jwt(payload, privk, alg,
                                  expires=(now + lt),
                                  not_before=not_before)
     yield clock_tick(timedelta(milliseconds=1500)), token