-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
[boschindego] Refactor OAuth2 implementation #14950
Conversation
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
f7af082
to
af874de
Compare
...dego/src/main/java/org/openhab/binding/boschindego/internal/handler/BoschAccountHandler.java
Show resolved
Hide resolved
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
You just afraid me. Why is so complex for this binding ? I just hope I have not missed something for all the other bindings I updated... |
Yeah, I was struggling a bit with the design. Mostly I'm addressing technical debt created by #14745 when I introduced the bridge being responsible for authorization, but still letting each child thing have their own API controller object. This PR decouples Next, I didn't want the bridge to renew tokens by itself without any requests from the child things. So I introduced a listener so that the bridge will be notified when authorization state changes, in which case the bridge should carry the proper description and the child things should track the status and become It may look a bit complex, but at least now responsibilities are clearly divided and bridge/things will be notified on important state updates both ways. I guess the alternative would be to let the bridge be responsible for everything, i.e. all API calls should go through the bridge. I'm not sure it's cleaner, but I may not have given it enough consideration. Any suggestions are welcome. Examples:
|
...dego/src/main/java/org/openhab/binding/boschindego/internal/handler/BoschAccountHandler.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you
* Delete OAuth2 token when thing is removed * Fix reinitialization * Introduce abstraction for OAuthClientService * Improve thing status synchronization --------- Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Thomas Burri <thomas.burri@alstomgroup.com>
* Delete OAuth2 token when thing is removed * Fix reinitialization * Introduce abstraction for OAuthClientService * Improve thing status synchronization --------- Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Matt Myers <mmyers75@icloud.com>
* Delete OAuth2 token when thing is removed * Fix reinitialization * Introduce abstraction for OAuthClientService * Improve thing status synchronization --------- Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk> Signed-off-by: Jørgen Austvik <jaustvik@acm.org>
This refactoring addresses some issues:
BRIDGE_OFFLINE
rather than the authorization failure description.Follow-up to #14745