-
-
Notifications
You must be signed in to change notification settings - Fork 428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[oauth] Token expiration is calculated from local time #3065
Comments
I am preparing a draft pull request with first step of this proposal. |
Do you know how many add-ons use this? I think we can do it on one step. |
@J-N-K - it would be simpler, yes, although temporarily breaking. I could prepare PR for addons so it would be ready. Addons affected:
|
Since this is not user facing, I would consider it acceptable. I can review here and if the PR here and in addons are approved I can merge first. That‘ll at most break one snapshot if addons is not merged the same day. |
@J-N-K - I have now adapted the PR to change the API at once, and also created a PR towards addons (mentioned above). |
This issue has been mentioned on openHAB Community. There might be relevant details there: https://community.openhab.org/t/automower-husqvarna/137401/9 |
When looking at openhab/openhab-addons#13274 I noticed a flaw in
AccessTokenResponse
: It usesLocalDateTime
for calculating token expiration. This means that the token creation time is dependent on system time-zone for being represented as an instant on the time-line.This has the potential to cause problems if system time-zone is changed or if the
LocalDateTime
provided forisExpired
is generated differently than howOAuthConnector
generates it.It would be less error-prone to use
Instant
forsetCreatedOn
,getCreatedOn
andisExpired
.I would propose to change this in five steps to avoid breaking addons:
AccessTokenResponse
change createdOn internally toInstant
. Add overload forisExpired
takingInstant
and deprecate current method. DeprecategetCreatedOn
and add newgetCreatedOnAsInstant
(temporary, for migration). ChangesetCreatedOn
to takeInstant
and adaptOAuthConnector
accordingly (currently no addons use this method).getCreatedOnAsInstant
and newisExpired
takingInstant
.getCreatedOn
to the same asgetCreatedOnAsInstant
and deprecate the latter. RemoveisExpired
takingLocalDateTime
.getCreatedOnAsInstant
togetCreatedOn
in addons.getCreatedOnAsInstant
.See also #2898.
The text was updated successfully, but these errors were encountered: