Martin Blanchard pushed to branch master at BuildGrid / buildgrid
Commits:
-
dfc579f8
by RichKen at 2019-02-26T17:09:22Z
2 changed files:
Changes:
... | ... | @@ -282,7 +282,7 @@ class AuthMetadataServerInterceptor(grpc.ServerInterceptor): |
282 | 282 |
if 'exp' not in payload or not isinstance(payload['exp'], int):
|
283 | 283 |
raise _UnboundedTokenError("Missing 'exp' in payload")
|
284 | 284 |
|
285 |
- return datetime.fromtimestamp(payload['exp'])
|
|
285 |
+ return datetime.utcfromtimestamp(payload['exp'])
|
|
286 | 286 |
|
287 | 287 |
|
288 | 288 |
def _unary_unary_rpc_terminator(details):
|
... | ... | @@ -188,7 +188,7 @@ def test_jwt_authorization(token, secret, algorithm, validity): |
188 | 188 |
@pytest.mark.skipif(not HAVE_JWT, reason="No pyjwt")
|
189 | 189 |
def test_jwt_authorization_expiry():
|
190 | 190 |
secret, algorithm = 'your-256-bit-secret', AuthMetadataAlgorithm.JWT_HS256
|
191 |
- now = int(datetime.utcnow().timestamp())
|
|
191 |
+ now = int(datetime.now().timestamp())
|
|
192 | 192 |
payload = {'sub': 'BuildGrid Expiry Test', 'iat': now, 'exp': now + 2}
|
193 | 193 |
token = jwt.encode(payload, secret, algorithm=algorithm.value.upper()).decode()
|
194 | 194 |
|