[webexteams] Remove the access token when the thing is removed (#14979)

Related to #14818

Signed-off-by: Laurent Garnier <lg.hc@free.fr>
This commit is contained in:
lolodomo 2023-05-11 22:03:00 +02:00 committed by GitHub
parent 14e7109a25
commit 88413c001d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,11 +147,17 @@ public class WebexTeamsHandler extends BaseThingHandler implements AccessTokenRe
OAuthClientService authService = this.authService; OAuthClientService authService = this.authService;
if (authService != null) { if (authService != null) {
authService.removeAccessTokenRefreshListener(this); authService.removeAccessTokenRefreshListener(this);
oAuthFactory.ungetOAuthService(thing.getUID().getAsString());
} }
oAuthFactory.ungetOAuthService(thing.getUID().getAsString());
cancelSchedulers(); cancelSchedulers();
} }
@Override
public void handleRemoval() {
oAuthFactory.deleteServiceAndAccessToken(thing.getUID().getAsString());
super.handleRemoval();
}
private void createIntegrationOAuthClientService(WebexTeamsConfiguration config) { private void createIntegrationOAuthClientService(WebexTeamsConfiguration config) {
String thingUID = this.getThing().getUID().getAsString(); String thingUID = this.getThing().getUID().getAsString();
logger.debug("Creating OAuth Client Service for {}", thingUID); logger.debug("Creating OAuth Client Service for {}", thingUID);