Fix requestOpenIdToken response: integer expires_in (#10175)

`expires_in` must be an integer according to the OpenAPI spec:
https://github.com/matrix-org/matrix-doc/blob/master/data/api/client-server/definitions/openid_token.yaml#L32

True division (`/`) returns a float instead (`"expires_in": 3600.0`).
Floor division (`//`) returns an integer, so the response is spec compliant.

Signed-off-by: Lukas Lihotzki <lukas@lihotzki.de>
This commit is contained in:
Lukas Lihotzki 2021-06-16 14:16:35 +02:00 committed by GitHub
parent 0adc2882c1
commit 2c240213f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

1
changelog.d/10175.bugfix Normal file
View File

@ -0,0 +1 @@
Fix a minor bug in the response to `/_matrix/client/r0/user/{user}/openid/request_token`. Contributed by @lukaslihotzki.

View File

@ -85,7 +85,7 @@ class IdTokenServlet(RestServlet):
"access_token": token, "access_token": token,
"token_type": "Bearer", "token_type": "Bearer",
"matrix_server_name": self.server_name, "matrix_server_name": self.server_name,
"expires_in": self.EXPIRES_MS / 1000, "expires_in": self.EXPIRES_MS // 1000,
}, },
) )