From 987dab90793a1df82ab3af9804f5dab89a18abe3 Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Fri, 10 Sep 2021 22:19:02 +0200 Subject: [PATCH] Uplift of Zutil --- build.gradle | 2 +- .../src/se/hal/plugin/assistant/google/SmartHomeImpl.java | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 2a276ff1..915f886f 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,7 @@ subprojects { apply plugin: 'java-library' dependencies { - implementation 'se.koc:zutil:1.0.304' + implementation 'se.koc:zutil:1.0.306' //implementation 'se.koc:zutil:1.0.0-SNAPSHOT' testImplementation 'junit:junit:4.12' diff --git a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java index 39b36f4b..ff331b04 100644 --- a/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java +++ b/plugins/hal-assistant-google/src/se/hal/plugin/assistant/google/SmartHomeImpl.java @@ -25,6 +25,7 @@ import com.google.protobuf.Struct; import com.google.protobuf.Value; import org.json.JSONObject; import se.hal.HalContext; +import se.hal.HalServer; import se.hal.intf.HalAbstractDevice; import se.hal.plugin.assistant.google.trait.DeviceTrait; import se.hal.plugin.assistant.google.trait.DeviceTraitFactory; @@ -58,6 +59,13 @@ public class SmartHomeImpl extends SmartHomeApp implements OAuth2TokenRegistrati userAgent = HalContext.getStringProperty(CONFIG_USER_AGENT); clientId = HalContext.getStringProperty(SmartHomeDaemon.CONFIG_CLIENT_ID); + for (String token : HalServer.getExternalWebDaemon().getOAuth2Registry().getAccessTokens(clientId)) { + if (HalServer.getExternalWebDaemon().getOAuth2Registry().isAccessTokenValid(token)) { + onTokenRegistration(clientId, + token, + HalServer.getExternalWebDaemon().getOAuth2Registry().getAccessTokenTimeout(token)); + } + } }